Mysql 檢視表結構

2021-09-30 16:42:27 字數 665 閱讀 1800

i    簡單描述表結構,字段型別

desc tabl_name;

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

ii     查詢表中列的注釋資訊

select * from information_schema.columns

where table_schema = 'db' #表所在資料庫

and table_name = 'tablename' ; #你要查的表

select table_name,column_name,is_nullable,data_type,column_type,column_key,column_comment from information_schema.columns

where table_schema = 'gong' #表所在資料庫

and table_name = 'fx_goods' ; #你要查的表

iii     #檢視表的注釋

select table_name,table_comment from information_schema.tables where table_schema = 'db' and table_name ='tablename'

iv   檢視表生成的ddl

show create table  tablename.

mysql檢視表結構索引 mysql檢視表結構命令

mysql檢視表結構命令,如下 desc 表名 show columns from 表名 describe 表名 show create table 表名 use information schema select from columns where table name 表名 順便記下 show...

mysql 檢視表結構

連線到mysql d mysql 5.6.10 winx64 bin mysql h192.168.1.1 u root proot hip u使用者名稱 p密碼 url 檢視表結構 url quote 檢視表結構資訊 本人相看,得到相同的結果 1.desc 表名 2.show columns fr...

mysql檢視表結構命令

mysql檢視表結構命令,如下 desc 表名 show columns from 表名 describe 表名 show create table 表名 use information schema select from columns where table name 表名 順便記下 show...