SQL语句查看表注释、字段注释【MySQL、Oracle】

MySQL:

       查看表注释:用 SHOW TABLE STATUS [FROM db_name]

              示例:

                       SHOW TABLE STATUS ; –数据库下所有表注释

                       SHOW TABLE STATUS FROM ‘dbname’; –数据库[dbname]下所有表注释

                       SHOW TABLE STATUS FROM ‘dbname’ WHERE NAME = ‘table’; –查看表[table]的注释

      查看字段注释:

              查询数据库 db_name 的 表 table_name 的字段信息:

                       select * from information_schema.columns T where table_schema =’db_name’ and table_name = ‘table_name’;

Oracle:

            查看表注释:

                SELECT * FROM USER_TAB_COMMENTS T WHERE T.TABLE_NAME=‘table_name’

                USER_TAB_COMMENTS :table_name,table_type,comments

            查看字段注释:

                默认为当前连接数据库

                SELECT * FROM USER_COL_COMMENTS T WHERE T.TABLE_NAME=‘table_name’

                SELECT T.TABLE_NAME,T.COLUMN_NAME,T.COMMENTS FROM USER_COL_COMMENTS T WHERE T.TABLE_NAME=‘table_name’

 

    原文作者:迷糊的小轩
    原文地址: https://blog.csdn.net/qq_42254198/article/details/105059913
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞