MySQL 檢視表結構簡單命令

2021-08-20 05:50:37 字數 1507 閱讀 1000

desc tabl_name;
顯示表結構,字段型別,主鍵,是否為空等屬性,但不顯示外來鍵。

例如:desc table_name

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' ;

例如:

例如:

例如:

該命令把建立表的ddl顯示出來,於是表結構、型別,外來鍵,備註全部顯示出來了。

null comment '商品銷售碼';

MySQL 檢視表結構簡單命令

一 簡單描述表結構,字段型別 desc tabl name 顯示表結構,字段型別,主鍵,是否為空等屬性,但不顯示外來鍵。例如 desc table name 二 查詢表中列的注釋資訊 select from information schema.columns where table schema ...

MySQL 檢視表結構簡單命令

desc tabl name 顯示表結構,字段型別,主鍵,是否為空等屬性,但不顯示外來鍵。例如 desc table name where table schema db 表所在資料庫 and table name tablename 你要查的表 例如 可以自動選擇你需要資訊 select colu...

MySQL 檢視表結構簡單命令

一 簡單描述表結構,字段型別 desc tabl name 顯示表結構,字段型別,主鍵,是否為空等屬性,但不顯示外來鍵。例如 desc table name 二 查詢表中列的注釋資訊 select from information schema.columns where table schema ...