Suppose we forget the column names in the existing table, then we can use the SHOWCOLUMNS statement to get the list of columns -
mysql> SHOW COLUMNS from Employee\G *************************** 1. row *************************** Field: Id Type: int(11) Null: YES Key: Default: NULL Extra: *************************** 2. row *************************** Field: Name Type: varchar(20) Null: YES Key: Default: NULL Extra: 2 rows in set (0.07 sec)
In the above example, we obtained the column list of the "Employee" table with the help of SHOW COLUMNS statement.
The above is the detailed content of How can we get the column list from an existing MySQL table?. For more information, please follow other related articles on the PHP Chinese website!