sql命令查看表結(jié)構(gòu) mysql數(shù)據(jù)庫(kù)怎么查看表結(jié)構(gòu)?
mysql數(shù)據(jù)庫(kù)怎么查看表結(jié)構(gòu)?MySQL 查看表結(jié)構(gòu)簡(jiǎn)單命令。 一、簡(jiǎn)單描述表結(jié)構(gòu),字段類型desc tabl_name顯示表結(jié)構(gòu),字段類型,主鍵,是否為空等屬性,但不顯示外鍵。二、查詢表中列的注釋
mysql數(shù)據(jù)庫(kù)怎么查看表結(jié)構(gòu)?
MySQL 查看表結(jié)構(gòu)簡(jiǎn)單命令。
一、簡(jiǎn)單描述表結(jié)構(gòu),字段類型desc tabl_name顯示表結(jié)構(gòu),字段類型,主鍵,是否為空等屬性,但不顯示外鍵。
二、查詢表中列的注釋信息select * from information_schema.columns where table_schema = "db" #表所在數(shù)據(jù)庫(kù)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ù)表中查看,我在實(shí)際操作中,常常不靈光,不知為什么,有了解的大俠請(qǐng)留印。五、查看表生成的DDL show create table table_name
在MySQL中顯示數(shù)據(jù)表orders的表結(jié)構(gòu)語法是什么?
下面是mysql輸出表結(jié)構(gòu)的sql語句:
SELECT COLUMN_NAME,--字段名稱
DATA_TYPE,--字段數(shù)據(jù)類型
COLUMN_COMMENT,--字段注釋
IS_NULLABLE --字段是否為空
FROM
INFORMATION_SCHEMA.Columns
WHERE
table_name="" tableName "" --表名
AND
table_schema="" databaseName ""--數(shù)據(jù)庫(kù)名