数据库
首页 > 数据库> > navicat生成数据字典sql

navicat生成数据字典sql

作者:互联网


SELECT
	TABLE_SCHEMA,
	TABLE_NAME,
	COLUMN_NAME,
	COLUMN_COMMENT,
	COLUMN_TYPE 
FROM
	information_schema.COLUMNS 
WHERE
	TABLE_SCHEMA = '数据库名';
	
	
USE information_schema;

SELECT
	C.COLUMN_NAME AS '字段名',
	C.COLUMN_COMMENT AS '字段说明',
	C.COLUMN_TYPE AS '数据类型',
	C.IS_NULLABLE AS '允许为空',
	C.EXTRA AS 'PK' 
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 = '数据库名' 
	AND T.TABLE_NAME = '表名';

标签:COMMENT,NAME,COLUMN,navicat,sql,TABLE,SCHEMA,SELECT,字典
来源: https://www.cnblogs.com/Arborblog/p/16635472.html