Mysql 查看錶註釋或字段註釋
查看所有表的註釋:
SELECT table_name 表名, table_comment 表說明 FROM information_schema.TABLES WHERE table_schema = '數據庫名' ORDER BY table_name
查詢所有表及字段的註釋:
SELECT a.table_name 表名, a.table_comment 表說明, b.COLUMN_NAME 字段名, b.column_comment 字段說明, b.column_type 字段類型, b.column_key 約束 FROM information_schema. TABLES a LEFT JOIN information_schema. COLUMNS b ON a.table_name = b.TABLE_NAME WHERE a.table_schema = '數據庫名' ORDER BY a.table_name
查詢某表的所有字段的註釋:
select COLUMN_NAME 字段名, column_comment 字段說明, column_type 字段類型, column_key 約束 from information_schema.columns where table_schema = '數據庫名' and table_name = '表名' ;
或者:
show full columns from 表名;
查看錶生成的DDL:
show create table 表名;