SELECT
COLUMN_NAME '列名',
COLUMN_COMMENT '中文描述',
(CASE WHEN ISNULL(concat(DATA_TYPE,'(',CHARACTER_MAXIMUM_LENGTH,')'))
THEN DATA_TYPE ELSE concat(DATA_TYPE,'(',CHARACTER_MAXIMUM_LENGTH,')') END ) as '数据类型',
(CASE WHEN ISNULL(COLUMN_DEFAULT) THEN '无' ELSE COLUMN_DEFAULT END ) as '默认值',
(CASE WHEN extra = 'auto_increment' THEN '是' ELSE '否' END ) as '是否自增',
(CASE WHEN COLUMN_KEY = 'PRI' THEN '是' ELSE '否' END ) as '是否主键 ',
(CASE WHEN extra = 'auto_increment' THEN '唯一' ELSE '无' END ) as '约束条件',
'无' AS '枚举或类型详细说明'
FROM
INFORMATION_SCHEMA. COLUMNS
WHERE
table_schema = 'aiec' #注意这里替换成你的数据库名字
AND table_name = 'component'
打开App,阅读手记