mysql創(chuàng)建數(shù)據(jù)庫表 mysql數(shù)據(jù)庫怎么查看表結(jié)構(gòu)?
mysql數(shù)據(jù)庫怎么查看表結(jié)構(gòu)?MySQL 查看表結(jié)構(gòu)簡單命令。 一、簡單描述表結(jié)構(gòu),字段類型desc tabl_name顯示表結(jié)構(gòu),字段類型,主鍵,是否為空等屬性,但不顯示外鍵。二、查詢表中列的注釋
mysql數(shù)據(jù)庫怎么查看表結(jié)構(gòu)?
MySQL 查看表結(jié)構(gòu)簡單命令。
一、簡單描述表結(jié)構(gòu),字段類型desc tabl_name顯示表結(jié)構(gòu),字段類型,主鍵,是否為空等屬性,但不顯示外鍵。
二、查詢表中列的注釋信息select * from information_schema.columns where table_schema = "db" #表所在數(shù)據(jù)庫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:二~四是在元數(shù)據(jù)表中查看,我在實際操作中,常常不靈光,不知為什么,有了解的大俠請留印。五、查看表生成的DDL show create table table_name
在mysql數(shù)據(jù)庫中,顯示表結(jié)構(gòu)用什么命令?
這個命令雖然顯示起來不是太容易看, 這個不是問題可以用G來結(jié)尾,使得結(jié)果容易閱讀;該命令把創(chuàng)建表的DDL顯示出來,于是表結(jié)構(gòu)、類型,外鍵,備注全部顯示出來了。我比較喜歡這個命令:輸入簡單,顯示結(jié)果全面。