查询数据库某个表的字段、属性、注释说明、是否主键、是否非空sql(mysql)
SELECT UPPER(column_name) AS '字段名称', column_comment AS '字段描述', UPPER(column_type) AS '字段类型', IF(column_key='PRI','TRUE','FALSE') AS '主键唯一', IF(IS_NULLABLE='NO','TRUE','FALSE') AS '...
·
SELECT
UPPER(column_name) AS '字段名称',
column_comment AS '字段描述',
UPPER(column_type) AS '字段类型',
IF(column_key='PRI','TRUE','FALSE') AS '主键唯一',
IF(IS_NULLABLE='NO','TRUE','FALSE') AS '非空'
FROM
information_schema. COLUMNS
WHERE
TABLE_SCHEMA = '数据库名称'
AND table_name = '表名';
更多推荐
已为社区贡献1条内容
所有评论(0)