I. Simple description table structure, field type
Desc Tabl_name;
Displays the table structure, the field type, the primary key, whether it is empty, and so on, but does not display foreign keys.
Second, the query table column of the comment information
SELECT * FROM Information_schema.columns
where Table_schema = ' db ' #表所在数据库
and table_name = ' tablename '; #你要查的表
Querying column names and comments only
Select column_name, column_comment from information_schema.columns where table_schema = ' db ' and table_name = ' tablename ' ;
Iv. #查看表的注释
Select Table_name,table_comment from information_schema.tables where table_schema = ' db ' and table_name = ' tablename '
PS: two ~ Four is in the metadata table to view, I in the actual operation, often do not have the light, do not know why, have the understanding of the heroes please leave the printing.
V. View the DDL generated by the table
Show CREATE TABLE table_name;
Although this command is not very easy to see, this is not a problem can be \g to the end, making the results easy to read; The command displays the DDL that created the table, so the table structure, type, foreign key, and comments are all displayed. I prefer this command: the input is simple and the results are comprehensive.
MySQL view table structure simple commands.