Oracle中查看所有的表,用户表,列名,主键,外键
select * from tab/dba_tables/dba_objects/cat;
看用户建立的表 :
select table_name from user_tables; //当前用户的表
select table_name from all_tables; //所有用户的表
select table_name from dba_tables; //包括系统表
select * from user_indexes //可以查询出所有的用户表索引
查所有用户的表在all_tables
主键名称、外键在all_constraints
索引在all_indexes
但主键也会成为索引,所以主键也会在all_indexes里面。
具体需要的字段可以DESC下这几个view,dba登陆的话可以把all换成dba
1、查找表的所有索引(包括索引名,类型,构成列):
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表
2、查找表的主键(包括名称,构成列):
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = "P" and au.table_name = 要查询的表
3、查找表的唯一性约束(包括名称,构成列):
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = "U" and au.table_name = 要查询的表
4、查找表的外键(包括名称,引用表的表名和对应的键名,下面是分成多步查询):
select * from user_constraints c where c.constraint_type = "R" and c.table_name = 要查询的表
查询外键约束的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键名称
查询引用表的键的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名
5、查询表的所有列及其属性
select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查询的表
转载于:https://www.cnblogs.com/xh831213/archive/2011/01/05/1926101.html
Oracle中查看所有的表,用户表,列名,主键,外键相关推荐
- 怎么查看oracle数据库表的主键,Oracle中查看所有的表,用户表,列名,主键,外键...
在Oracle中查看所有的表: select * from tab/dba_tables/dba_objects/cat; 看用户建立的表 : select table_name from user_ ...
- oracle 其他用户表主键,Oracle中查看所有的表,用户表,列名,主键,外键
在Oracle中查看所有的表: select * from tab/dba_tables/dba_objects/cat; 看用户建立的表 : select table_name from user_ ...
- oracle查询列属性,Oracle中查看所有的表,列,属性,…
在Oracle中查看所有的表: select * from tab/dba_tables/dba_objects/cat; 看用户建立的表 : select table_name from user ...
- oracle自动释放表空间,Oracle中关于清除数据和释放表空间
一.表的重命名 flashback table test2 to before drop rename to test3;--[to test3]将表重命名 drop table test3 purg ...
- Oracle中select函数以及分组多表连接等重要点以及示例
Oracle中select函数以及分组多表连接等重要点 函数 –函数 –内置函数和自定义函数 –单行函数:一条记录返回一个结果的 –多行函数|组函数|聚合函数:多条记录返回一条结果的 单行函数 单行函 ...
- oracle中查看用户权限
oracle中查看用户权限 博客分类: Oracle权限 OracleSQL 1.查看所有用户: select * from dba_users; select * from all_user ...
- mysql显示表的所有列车_MySQL中查看当前数据库的所有表
关键词 MySQL数据库 表 摘要 本文介绍在MySQL数据库中,如何列出并查看当前数据库的所有表. 本文介绍在MySQL数据库中,如何列出并查看当前数据库的所有表. 我们创建一个数据库之后,数据库里 ...
- mysql查看当前数据库中表明,MySQL中查看当前数据库的所有表
关键词 MySQL数据库 表 摘要 本文介绍在MySQL数据库中,如何列出并查看当前数据库的所有表. 本文介绍在MySQL数据库中,如何列出并查看当前数据库的所有表. 我们创建一个数据库之后,数据库里 ...
- oracle查看有哪些数据库用户登录,oracle如何查看当前有哪些用户连接到数据库,oracle当前有...
oracle如何查看当前有哪些用户连接到数据库,oracle当前有 可以执行以下语句: select username,serial#, sid from v$session; ---查询用户会话 a ...
- mysql建表时外检怎么创建_MySQL创建表时加入的约束以及外键约束的的意义
1,创建表时加入的约束 a) 非空约束,not null b) 唯一约束,unique c) 主键约束,primary key d) 外键约束,foreign key 1,非空约束,针对某个字段设置其 ...
最新文章
- 为什么现在大家喜欢用3*3小卷积?
- PHP中对象的深拷贝与浅拷贝
- 最快让你上手ReactiveCocoa之基础篇
- 对kubernetes的认识
- jQuery EasyUI使用教程之创建可折叠面板
- boost::parameter::deduced相关的测试程序
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- mysql source code_Source Code
- java 程序找错_JAVA程序找错~
- WEB网页专业词汇 汇总
- pip:你真的熟悉怎么用了吗?
- linux之rename命令
- 入驻就有收益的自媒体平台:趣头条
- 字节女实习生被通报批评,只因晚上12点就睡觉
- 补能的争议路线:快充会走向大一统吗?
- LeetCode——517. 超级洗衣机(Super Washing Machines)[困难]——分析及代码(C++)
- MFC实现CIE1931
- 在win10上去除移动硬盘的bitlocker
- linux搜索命令有哪些,linux 中的搜索命令
- DELL PowerEdge 远程开机
热门文章
- 【原创】NIO框架入门(四):Android与MINA2、Netty4的跨平台UDP双向通信实战
- 使用Web Deploy进行远程部署
- 通过binlog恢复mysql数据库
- maven工程下管理module发布到SVN注意
- 这个时代再也难出现贵子
- POJ 3415 Common Substrings (后缀数组,长度不小于k的公共子串的个数)
- 常用响应式web UI框架搜集整理
- FAT文件系统“格式化”的恢复方法
- HttpClient ip直连域名问题那些事
- BZOJ1096[ZJOI2007] 仓库建设