使用Navicat导出数据字典

USE information_schema;

SELECT
    C.TABLE_NAME AS '表名' ,
    T.TABLE_COMMENT AS '表中文名' ,
    C.COLUMN_NAME AS '字段名' ,
    C.COLUMN_COMMENT AS '字段中文名' ,
    C.COLUMN_TYPE AS '数据类型' ,
    C.EXTRA AS '主键'
FROM
    COLUMNS C
INNER JOIN TABLES T ON C.TABLE_SCHEMA = T.TABLE_SCHEMA
AND C.TABLE_NAME = T.TABLE_NAME
WHERE
    T.TABLE_SCHEMA = 'kanjia'


SELECT
    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 = '数据库';


SELECT
    TABLE_NAME AS '表名',
    COLUMN_NAME AS '字段名',
    COLUMN_TYPE AS '数据类型',
    IS_NULLABLE AS '允许为空',
    COLUMN_COMMENT AS '字段说明' 
FROM
    information_schema.`COLUMNS` 
WHERE
    TABLE_SCHEMA = 'boxuewz'

你可能感兴趣的:(Mysql)