美文网首页
导出数据字典

导出数据字典

作者: 风起依旧 | 来源:发表于2020-03-09 19:55 被阅读0次
USE information_schema;

SELECT
    T.TABLE_SCHEMA AS '数据库名称',
    T.TABLE_NAME AS '表名',
    T.TABLE_TYPE AS '表类型',
    T. ENGINE AS '数据库引擎',
    C.ORDINAL_POSITION AS '字段编号',
    C.COLUMN_NAME AS '字段名',
    C.COLUMN_TYPE AS '数据类型',
    C.IS_NULLABLE AS '允许为空',
    C.COLUMN_KEY AS '键类型',
    C.EXTRA AS '自增属性',
    C.CHARACTER_SET_NAME AS '编码名称',
    C.COLUMN_COMMENT 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 = 'mysql'  --指定要生成数据字典的数据库

相关文章

网友评论

      本文标题:导出数据字典

      本文链接:https://www.haomeiwen.com/subject/uqzudhtx.html