其他分享
首页 > 其他分享> > 查询表信息-用于编写文档

查询表信息-用于编写文档

作者:互联网

SELECT
(@i:=@i+1) AS `序号`,
COLUMN_NAME AS `字段名`,

DATA_TYPE AS `数据类型`,

coalesce(CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION) AS`长度`,

NUMERIC_PRECISION AS `数字长度`,


IS_NULLABLE AS `是否允许非空`,

CASE WHEN EXTRA = 'auto_increment' THEN '是' ELSE '否' END AS `是否自增`,

COLUMN_DEFAULT AS `默认值`,

COLUMN_COMMENT AS `备注`

FROM information_schema.COLUMNS ,(select @i:=0) as it WHERE TABLE_SCHEMA='smma_one_company_nodata' AND TABLE_NAME='b_common_file';

 

 

 

 

标签:NAME,COLUMN,长度,PRECISION,NUMERIC,查询,文档,TABLE,编写
来源: https://www.cnblogs.com/fuerming/p/16131453.html