select
table_catalog,
table_schema as 資料庫名,
table_name as 表名,
column_name as 欄位名,
ordinal_position as 字段位置,
column_default as 字段預設值,
is_nullable 是否允許空值,
data_type as 資料型別,
character_maximum_length as 以字元為單位的最大長度,
character_octet_length as 以位元組為單位的最大長度,
numeric_precision as 數值型別的長度,
numeric_scale as 小數點精度,
datetime_precision as 回的日期時間值的精度,
character_set_name as 編碼方式,
collation_name as 校對集,
column_type as 字段型別,
column_key as 鍵,
extra as 額外的資訊例如自動遞增在這裡顯示,
privileges as 許可權,
column_comment as 字段注釋,
generation_expression
from
information_schema. columns
where
table_schema = '***'
select
b.`表注釋`,
information_schema.columns.table_name as '表名',
information_schema.`columns`.column_name as '欄位名',
information_schema.`columns`.column_type as '資料型別',
information_schema.`columns`.column_default as 字段預設值,
information_schema.`columns`.character_maximum_length as 以字元為單位的最大長度,
information_schema.`columns`.character_octet_length as 以位元組為單位的最大長度,
information_schema.`columns`.numeric_precision as 數值型別的長度,
information_schema.`columns`.numeric_scale as 小數點位數,
information_schema.`columns`.is_nullable as '允許為空',
information_schema.`columns`.column_comment as '字段說明'
from
information_schema.`columns` left join
(select
information_schema.tables.table_comment as '表注釋',
information_schema.tables.table_name as '表名'
from
information_schema.tables
where
table_schema = 'sub_test') b
on information_schema.columns.table_name = b.`表名`
where
table_schema = 'sub_test'
mysql 匯出資料字典
select table catalog,table schema as 資料庫名,table name as 表名,column name as 欄位名,ordinal position as 字段位置,column default as 字段預設值,is nullable 是否允許空值,data...
SQL 匯出資料字典
用於參考 select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,主鍵 case ...
mysql資料字典
1 顯示資料庫列表2 顯示當前連線的資料庫 mysql select database 3 顯示庫中的資料表 mysql use mysql 指定mysql庫 mysql show tables 4 顯示資料表的結構 mysql describe yourtablename 說明 describe ...