查询所有字段注释
字段注释查询方式1
查询语法如下:
show full columns from 表名;
案例:查询 student 表中所有字段的注释信息:
show full columns from student;
执行结果如下图所示:
字段注释查询方式2
查询语法如下:
select COLUMN_NAME 字段名,column_comment 字段说明,column_type 字段类型, column_key 约束 from information_schema.columns where table_schema='数据库名' and table_name='表名';
案例:查询 student 表中所有字段的注释信息:
select COLUMN_NAME 字段名,column_comment 字段说明,column_type 字段类型, column_key 约束 from information_schema.columns where table_schema='test2022' and table_name='student';
执行结果如下图所示: