一、在数据库中执行以下脚本,注意最后的xxxxxxxx要修改为数据库名称
SELECT
t.TABLE_COMMENT 表中文名称,
t.TABLE_NAME 表英文名,
c.COLUMN_NAME 字段名称,
c.COLUMN_COMMENT 字段中文名称,
CASE
WHEN c.COLUMN_KEY = 'PRI' THEN
'主键' ELSE ''
END AS 业务定义,
'无' 业务规则,
c.COLUMN_TYPE 字段类型,
CASE
WHEN c.COLUMN_KEY = 'PRI' THEN
'主键'
WHEN c.COLUMN_KEY = 'MUL' THEN
'多重索引'
WHEN c.COLUMN_KEY = 'UNI' THEN
'唯一索引' ELSE ''
END AS 主外键,
CASE
WHEN c.IS_NULLABLE = 'YES' THEN
'是'
WHEN c.IS_NULLABLE = 'NO' THEN
'否'
END AS 是否可空
FROM
INFORMATION_SCHEMA.TABLES t
JOIN INFORMATION_SCHEMA.COLUMNS c ON t.TABLE_NAME = c.TABLE_NAME
WHERE
t.TABLE_SCHEMA = 'xxxxxxxx';