Show Comment of Fields FROM Mysql Table

SHOW COLUMNS FROM <tablename> gives all the information of the columns in a table, except Comments.

How to extract Comments information? I know the way to extract the information from INFORMATION SCHEMA, but how to combine the result in a single result set?


Solution 1:

You can use the query

SHOW FULL COLUMNS FROM <tablename>

If you don't want to use information_schema.

Solution 2:

select `column_name`, `column_type`, `column_default`, `column_comment`
from `information_schema`.`COLUMNS` 
where `table_name` = 'table-name' 
and `table_schema` = 'db-name';