Sql. Cookbook Reading notes 5 meta-data query

Source: Internet
Author: User

The fifth Chapter Metadata query query database itself Information table structure index, etc.

5.1 Querying all table information under the test library

Mysql

 from ' Test ';

ORACLE

Select  from where ' Test ';

5.2 Querying the information for columns in a table

Mysql

SELECT *  from WHERE = ' Test '  and = ' Student ';

ORACLE

Select *  from where = ' Test '  and = ' Student ';

5.3 List Indexes of tables

Mysql

Index  from EMP;

ORACLE

Select  from where = ' EMP '  and = ' Test ';

5.4 Listing table constraints

ORACLE

Select  from where = ' EMP '  and = ' Test '  and =  and =  and = b.constraint_name;

Mysql

 select  A.table_name,a.constraint_name,b.coulumn_name,a.constraint_ Type from  information_schema.table_constraints A,information_schema.key_ Column_usage b where  a.table_name  '  

5.5 Display table structure

desc user;

Sql. Cookbook Reading notes 5 meta-data query

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.