MS SQL Server 1, querying all tables select [ID], [name] from [sysobjects] where [type] = ' u ' ORDER BY [name] 2, querying all Databases 3, select [Name] F ROM [sysdatabases] ORDER BY [Name] Query table field select [Name] from [syscolumns] where [name] = ' tablexxx ' ORDER by [Colid]
Oracle
1. Find all indexes of the table (including 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.tabl E_name and t.table_name = table to query
2. lookup table's primary key (including 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, find the uniqueness of the table constraints (including the name, the constituent column):
Select column_name from User_cons_columns cu, user_constraints au where cu.constraint_name = Au.constraint_name and Au.con Straint_type = ' U ' and au.table_name = table to query
4. Find the foreign key of the table (including the name, the table name of the reference table and the corresponding key name, the following is divided into multi-step query):
SELECT * from user_constraints c where c.constraint_type = ' R ' and c.table_name = table to query
Query the column name of the FOREIGN KEY constraint:
SELECT * from User_cons_columns cl where cl.constraint_name = FOREIGN key Name
Query the column name of the key referencing the table:
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
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
6. Check all tables select* from tabs
SQL query Summary of all databases, table names, tables fields