SELECT
table_name as '表名',
COLUMN_NAME as '字段名称',
COLUMN_TYPE as '数据类型',
if(COLUMN_KEY='PRI','Y','N') as '主键',
COLUMN_COMMENT as '备注'
FROM
INFORMATION_SCHEMA. COLUMNS
WHERE
table_schema = '数据库名称'
AND
table_name = '数据表名称'
order by table_name,ordinal_position
https://blog.csdn.net/cplvfx/article/details/108292814