mysql 获取表字段说明SQL


SELECT
TABLE_NAME as '表名',
column_name AS '列名',
data_type AS '数据类型',
character_maximum_length AS '字符长度',
numeric_precision AS '数字长度',
numeric_scale AS '小数位数',
is_nullable AS '是否允许非空',
CASE WHEN extra = 'auto_increment'
THEN 1 ELSE 0 END AS '是否自增',
column_default AS '默认值',
column_comment AS '备注'

from information_schema.COLUMNS

order by TABLE_NAME asc

智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告