如何把数据库字段导出成表格
参考地址:
https://blog.csdn.net/dkjkls/article/details/87902067
mysql语句
SELECT
TABLE_NAME 表名,
COLUMN_NAME 字段名称,
COLUMN_TYPE 字段类型,
COLUMN_DEFAULT 默认值,
CHARACTER_MAXIMUM_LENGTH AS 最大长度,
(
CASE
WHEN is_nullable = 'NO' THEN
'否'
ELSE
'是'
END
) AS 是否可空,
(
CASE
WHEN column_key = 'PRI' THEN
'是'
ELSE
'否'
END
) AS 是否主键,
COLUMN_COMMENT 描述
FROM
INFORMATION_SCHEMA. COLUMNS
WHERE
TABLE_SCHEMA = 'yourdb';
转载请注明来源:https://www.cnblogs.com/bugutian/