导航

不同数据源获取表与字段注释

Posted on 2020-04-21 14:03  那年雨时  阅读(198)  评论(0)    收藏  举报

-- mysql查看表的注释sql
SELECT TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '表名' AND TABLE_SCHEMA = '库名'


-- mysql表字段内的注释
Select COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT from INFORMATION_SCHEMA.COLUMNS Where table_name = '表名'  AND table_schema = '数据库名'  AND column_name LIKE '字段名' 

 

-- oracle获取表字段:
select * from user_tab_columns where Table_Name='表名' order by column_name

 

-- oracle获取表注释:
select * from user_tab_comments where Table_Name='表名' order by Table_Name

 

-- oracle获取字段注释:
select * from user_col_comments where Table_Name='表名' order by column_name

 

-- pgsql获取表与字段注释
select * from pg_description join pg_class on pg_description.objoid = pg_class.oid where relname = '表名'