当前位置:网站首页>Oracle query table index, unique constraint, field
Oracle query table index, unique constraint, field
2022-07-06 04:57:00 【Terence-Wang】
Query the index of the table
select t.Index_Name,t.table_name,t.column_name,i.tablespace_name,i.uniqueness 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=' Upper case table name : Lowercase table names are not supported here ';
1、 Look up all indexes of the table ( Include index name , type , Constituent column ):
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 = Table to query
2、 Primary key of lookup table ( Include the name , Constituent column ):
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 = Table to query
3、 Uniqueness constraints for lookup tables ( Include the name , Constituent column ):
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 = Table to query
4、 Foreign key of lookup table ( Include the name , The table name and corresponding key name of the reference table , The following is a multi-step query ):
select * from user_constraints c where c.constraint_type = 'R' and c.table_name = Table to query
Query the column names of foreign key constraints :
select * from user_cons_columns cl where cl.constraint_name = Name of the foreign key
Query the column name of the key of the reference table :
select * from user_cons_columns cl where cl.constraint_name = The foreign key refers to the key name of the table
5、 Query all the columns of a table and their properties
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 = Table to query
Inquire about oracle List the information ( surface , Field , constraint , Indexes )
1、 Find out all the user tables
select * from user_tables You can query all user tables
2、 Query the indexes of all tables of the user
select * from user_indexes
3、 Query the index of the user table ( Nonclustered indexes ):
select * from user_indexes where uniqueness='NONUNIQUE'
4、 Query the primary key of the user table ( Clustered index ):
select * from user_indexes where uniqueness='UNIQUE'
5、 Index of query table
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and
t.table_name='NODE'
6、 Primary key of query table
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and
au.constraint_type = 'P' AND cu.table_name = 'NODE'
7、 Uniqueness constraints for lookup tables ( Include the name , Constituent column ):
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name=au.constraint_name and
cu.table_name='NODE'
8、 Foreign key of lookup table
select * from user_constraints c where c.constraint_type = 'R' and c.table_name='STAFFPOSITION'
Query the column names of foreign key constraints :
select * from user_cons_columns cl where cl.constraint_name = Name of the foreign key
Query the column name of the key of the reference table :
select * from user_cons_columns cl where cl.constraint_name = The foreign key refers to the key name of the table
9、 Query all the columns of a table and their properties
select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name='NODE'
边栏推荐
- The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
- 關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
- Bubble sort
- Leetcode dynamic planning day 16
- EditorUtility.SetDirty在Untiy中的作用以及应用
- RT thread analysis log system RT_ Kprintf analysis
- GAMES202-WebGL中shader的編譯和連接(了解向)
- MySQL reported an error datetime (0) null
- [lgr-109] Luogu may race II & windy round 6
- Extension of graph theory
猜你喜欢
Yolov5 tensorrt acceleration
[classic example] binary tree recursive structure classic topic collection @ binary tree
Ue5 small knowledge points to enable the setting of lumen
MPLS experiment
Crazy God said redis notes
Microblogging hot search stock selection strategy
Application of Flody
图论的扩展
Sqlserver query results are not displayed in tabular form. How to modify them
ORM aggregate query and native database operation
随机推荐
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
web工程导入了mysql驱动jar包却无法加载到驱动的问题
ue5 小知识点 开启lumen的设置
Excellent PM must experience these three levels of transformation!
[noip2008 improvement group] stupid monkey
Digital children < daily question> (Digital DP)
Embedded development program framework
ue5 小知识 FreezeRendering 查看视锥内渲染的物体
Luogu deep foundation part 1 Introduction to language Chapter 2 sequential structure programming
Distributed transaction solution
關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
[NOIP2008 提高组] 笨小猴
Why does MySQL need two-phase commit
Postman前置脚本-全局变量和环境变量
图论的扩展
Drive development - the first helloddk
Leetcode 186 Flip the word II in the string (2022.07.05)
The kernel determines whether peripherals are attached to the I2C address
The web project imported the MySQL driver jar package but failed to load it into the driver
2021 robocom world robot developer competition - undergraduate group (semi-finals)