Some SQL (under Oracle) summaries used in the project: 1. Find all indexes of the table (including index name, type, constituent column)
1 Select T.*,i.index_type from User_ind_columns t,user_indexes i where t.index_name = I.index_name and T.tab Le_name = i.table_name and t.table_name = table to query
2. lookup table's primary key (including name, constituent column)
1 Select cu.* from User_cons_columns cu, user_constraints au where cu.constraint_name = Au.constraint_name A nd au.constraint_type = 'P' and au.table_name = table to query
3, find the uniqueness of the table constraints (including the name, the constituent column)
1 Select column_name from User_cons_columns cu, user_constraints au where cu.constraint_name = Au.constrain T_name and Au.constraint_type = 'U' and au.table_name = table to query
4, the lookup table of foreign keys (including the name, the table name of the reference table and the corresponding key name, the following is divided into multi-step query) query table information
1 a) SELECT * from user_constraints c where C.constraint_type = 'R' and c.table_name = table to query
Querying column names for foreign KEY constraints
1 B) select * from User_cons_columns cl where cl.constraint_name = FOREIGN key Name
Query the column name of the key referencing the table
1 C) SELECT * from User_cons_columns cl where cl.constraint_name = foreign key reference table key name
5. Querying all columns of the table and their properties
1 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 2
Oracle query Table primary KEY, foreign key