将表结构导出为excel
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 = '库名' order by table_name
欢迎各位指点!