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’