1. 程式人生 > >查詢數據庫所有表和字段及其註釋(mysql)

查詢數據庫所有表和字段及其註釋(mysql)

columns pre height 約束 ble 註釋 where for 所有

#查詢某個庫所有表 select * from information_schema.TABLES where table_schema = ‘數據庫‘ #查詢某個庫所有表的字段 select * from information_schema.COLUMNS where table_schema = ‘數據庫‘ #查詢所有表的註釋和字段註釋 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

查詢數據庫所有表和字段及其註釋(mysql)