通过以下语句查询出来后,用 navicat 导出结果为 excel 就行了
SELECT C.TABLE_SCHEMA 库名, C.TABLE_NAME 表名, C.COLUMN_NAME 列名, C.COLUMN_TYPE 数据类型, C.DATA_TYPE 字段类型, C.CHARACTER_MAXIMUM_LENGTH 长度, C.IS_NULLABLE 是否为空, C.COLUMN_DEFAULT 默认值, C.COLUMN_COMMENT 备注 , K.REFERENCED_TABLE_NAME 关联表名称, K.REFERENCED_COLUMN_NAME 关联字段 FROM INFORMATION_SCHEMA.COLUMNS C Left join (SELECT * from information_schema.KEY_COLUMN_USAGE where REFERENCED_TABLE_NAME is not null) K on K.CONSTRAINT_SCHEMA = C.TABLE_SCHEMA and K.TABLE_NAME = C.TABLE_NAME and K.COLUMN_NAME = C.COLUMN_NAME where C.table_schema ='database_name' AND (C.table_name like "ecs_%" or C.table_name like "sys_%")