"Go" Oracle queries all tables of users

Source: Internet
Author: User

    1. Querying all users ' tables, views, etc.
Select *  from All_tab_comments;

2. Query This user's table, view, etc.

Select *  from User_tab_comments;

3. Query the column names and comments for all users ' tables

Select *  from All_col_comments;

4. Query the column names and comments for this user's table

Select *  from User_col_comments;

5. Query the column names of all users ' tables (detailed but no notes)

Select *  from All_tab_columns;

6. Query the user's table column name and other information (detailed but no notes)

Select *  from User_tab_columns;

7. General use 1

Select  from User_tab_comments t;

8. General use 2

Select R1, R2, R3, R5  from (Select  a.table_name R1, A.column_name R2, a.comments R3          from  user_col_comments a),       (Select from user_tab_comments t) where = R1;

How to query the table name, primary key name, index, foreign key, and so on for all user tables in Oracle

1. Find all indexes of the table (including index name, type, constituent column)

SELECT T.*, i.index_type  fromWHERE=  i.index_name   and =  i.table_name   and=' table to query  ';

2. lookup table's primary key (including name, constituent column)

SELECT CU.*  fromWHERE=  AU. Constraint_name   and='P'    and  =' table to query ';

3. Find a table's uniqueness constraints (including name, constituent columns)

SELECT column_name    from  WHERE=  AU. Constraint_name   and='U'    and  =' 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, which is divided into multi-step query)

The first step:

Select *  from where = ' R '  and = ' the table to query ';

Step two: Query the column name of the FOREIGN KEY constraint

Select *  from where = ' FOREIGN Key Name ';

Step three: Query the column name of the key referencing the table

Select *  from where = ' Key name of foreign key reference table ';

5. Querying all columns and their properties of a table

SELECT T.*, c.comments  fromWHERE=  c.table_name     and = c.column_name     and = ' the table to query ';

Transferred from: http://www.2cto.com/database/201212/174394.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.