sql语句如下:
select
a.ordinal_position '序号',
a.COLUMN_name '字段名',
a.COLUMN_type '字段类型',
(case a.is_nullable when 'NO' then '是' else '否' end) '是否非空',
(case a.column_key when 'PRI' then '是' else '否' end) '是否主键',
a.COLumn_comment '注释'
from
information_schema.COLUMNS a
where
TABLE_schema = 'sbps'
and TABLE_name = 'user';
结果: