oracle查询库中所有表名、字段、主键

1、查询所有表

select t.table_name as tablecode,t1.comments as tablename from user_tables t,user_tab_comments t1 where t.TABLE_NAME=t1.TABLE_NAME and t.table_name='TEST'

2、查询表中所有字段

select t.column_name as columncode,t.comments as columnname from user_col_comments t where t.table_name='TEST';

 3、查询主键  

select  col.COLUMN_NAME from user_constraints con,user_cons_columns col where con.constraint_name=col.constraint_name and con.constraint_type='P' and col.table_name='TEST'

posted on 2018-01-26 17:11  小华同学  阅读(1113)  评论(0)    收藏  举报

导航