二、查詢表中列的註釋資訊select * from information_schema.columns where table_schema = "db" #表所在資料庫and table_name = "tablename" ; #你要查的表三、只查詢列名和註釋select column_name, column_comment from information_schema.columns where table_schema ="db" and table_name = "tablename" ;四、#查看錶的註釋select table_name,table_comment from information_schema.tables where table_schema = "db" and table_name ="tablename"ps:二~四是在元資料表中檢視,我在實際操作中,常常不靈光,不知為什麼,有了解的大俠請留印。五、查看錶生成的DDL show create table table_name;
MySQL 查看錶結構簡單命令。
一、簡單描述表結構,欄位型別desc tabl_name;顯示錶結構,欄位型別,主鍵,是否為空等屬性,但不顯示外來鍵。
二、查詢表中列的註釋資訊select * from information_schema.columns where table_schema = "db" #表所在資料庫and table_name = "tablename" ; #你要查的表三、只查詢列名和註釋select column_name, column_comment from information_schema.columns where table_schema ="db" and table_name = "tablename" ;四、#查看錶的註釋select table_name,table_comment from information_schema.tables where table_schema = "db" and table_name ="tablename"ps:二~四是在元資料表中檢視,我在實際操作中,常常不靈光,不知為什麼,有了解的大俠請留印。五、查看錶生成的DDL show create table table_name;