作者:顾玉妙 | 来源:互联网 | 2023-10-14 18:53
篇首语:本文由编程笔记#小编为大家整理,主要介绍了生出数据字典相关的知识,希望对你有一定的参考价值。
SELECT
t.TABLE_SCHEMA AS 库名,
t.TABLE_NAME AS 表名,
t.COLUMN_NAME AS 字段名,
t.COLUMN_TYPE AS 数据类型,
CASE IFNULL(t.COLUMN_DEFAULT,‘Null‘)
WHEN ‘‘ THEN ‘空字符串‘
WHEN ‘Null‘ THEN ‘NULL‘
ELSE t.COLUMN_DEFAULT END AS 默认值,
CASE t.IS_NULLABLE WHEN ‘YES‘ THEN ‘是‘ ELSE ‘否‘ END AS 是否允许为空,
t.COLUMN_COMMENT AS 字段说明
FROM information_schema.COLUMNS t
WHERE t.TABLE_SCHEMA=‘feifei‘ AND t.TABLE_NAME=‘order_info‘;