目录
oracle
数据表
视图
mysql
数据表
视图
hive
表
视图
pg
表
视图
oracle
数据表
SELECT a.owner AS owner,a.TABLE_NAME AS bywm,a.comments AS bzwm FROM all_tab_comments a
where a.OWNER
NOT IN ('SYS', 'SYSTEM', 'CTXSYS', 'XDB', 'EXFSYS', 'MDSYS', 'OLAPSYS', 'APEX_030200', 'ORDDATA', 'OUTLN', 'SYSMAN', 'WMSYS',
'ORDSYS', 'DBSNMP', 'MDDATA','MGMT_VIEW', 'ORDPLUGINS', 'SCOTT', 'SI_INFORMATN_SCHEMA', 'WK_TEST', 'WKPROXY', 'WKSYS', 'WMSYS',
'XDB', 'FLOWS_FILES', 'ANONYMOUS', 'APPQOSSYS', 'OWBSYS_AUDIT', 'OWBSYS', 'SI_INFORMTN_SCHEMA', 'IX', 'SH', 'DIP', 'OE',
'APEX_PUBLIC_USER', 'HR', 'SPATIAL_CSW_ADMIN_USR', 'ORACLE_OCM', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL', 'BI', 'PM')
视图
SELECT
A.OWNER,
A.VIEW_NAME ,
B.*,
A.TEXT
FROM
ALL_VIEWS A,
ALL_TAB_COMMENTS B
WHERE
A.VIEW_NAME = B.TABLE_NAME AND A.TEXT is not NULL AND A.OWNER = B.OWNER
AND A.OWNER
NOT IN ('SYS', 'SYSTEM', 'CTXSYS', 'XDB', 'EXFSYS', 'MDSYS', 'OLAPSYS', 'APEX_030200', 'ORDDATA', 'OUTLN', 'SYSMAN', 'WMSYS',
'ORDSYS', 'DBSNMP', 'MDDATA','MGMT_VIEW', 'ORDPLUGINS', 'SCOTT', 'SI_INFORMATN_SCHEMA', 'WK_TEST', 'WKPROXY', 'WKSYS', 'WMSYS',
'XDB', 'FLOWS_FILES', 'ANONYMOUS', 'APPQOSSYS', 'OWBSYS_AUDIT', 'OWBSYS', 'SI_INFORMTN_SCHEMA', 'IX', 'SH', 'DIP', 'OE',
'APEX_PUBLIC_USER', 'HR', 'SPATIAL_CSW_ADMIN_USR', 'ORACLE_OCM', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL', 'BI', 'PM')
mysql
数据表
select * from information_schema.tables where table_type='BASE TABLE'
and table_schema not in ('performance_schema', 'mysql', 'sys', 'information_schema')
视图
select * from information_schema.tables
where table_type in('view','VIEW')
and table_schema not in ('performance_schema', 'mysql', 'sys', 'information_schema')
hive
表
查询表
先切换shema到目标库,然后查表
use bqtest;
show tables;
查具体的表信息,以t_dj_qyxx为例
desc formatted `t_dj_qyxx`
视图
先切换shema到目标库,然后查视图
use bqtest;
show views
pg
表
SELECT
pc.relname AS bywm,
pds.description AS bzwm,
pn.nspname AS OWNER,
pd.datname AS DATABASE
FROM
pg_class pc
INNER JOIN pg_namespace pn ON pn.oid = pc.relnamespace
INNER JOIN pg_database pd ON pd.datdba = pn.nspowner
AND pd.datistemplate =
FALSE LEFT JOIN pg_description pds ON pc.oid = pds.objoid
AND pds.objsubid = 0
WHERE
pc.relkind IN ( 'r', 'p' ) AND pc.oid NOT IN ( SELECT inhrelid FROM pg_inherits )
视图
select schemaname, viewname from pg_views