mysql get table columns code example
Example 1: get the mysql table columns data type mysql
SHOW COLUMNS FROM mydb.mytable;
Example 2: mysql show column data types
SELECT DATA_TYPE from INFORMATION_SCHEMA.COLUMNS where
table_schema = ’yourDatabaseName’ and table_name = ’yourTableName’.
Example 3: MySql get fields of table
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';