场景:
- 要查询数据库 “my_table_name” 下所有表名以及表注释
/* 查询数据库 ‘my_table_name’ 所有表注释 */
select table_name,table_comment
from information_schema.tables
where table_schema='my_table_name';
- 要查询表字段的注释
/* 查询数据库 ‘mammothcode’ 下表 ‘my_table_name1’ 所有字段注释 */
select column_name,column_comment
from information_schema.columns
where table_name='my_table_name1' and table_schema='mammothcode'
- 一次性查询数据库 “mammothcode” 下表注释以及对应表字段注释
select t.table_name,t.table_comment,
c.column_name,c.column_type,c.column_comment
from information_schema.tables t,information_schema.columns c
where c.table_name=t.table_name and t.`table_schema`='mammothcode'
还可以使用存储过程,下次讲解!
————————————————
版权声明:本文为CSDN博主「政东.zd」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u013952845/article/details/106929821