Add comments to tables and columns

Source: Internet
Author: User

In the SQL statement, we can add two connectors after the statement, and then write some comments.

So how can we add some comments to tables and columns? Such comments are also very useful, because it is still difficult to see the name of a table or column.

 

1. Add comments to the table:

 

Create annotation Syntax:

Comment on table table_name is 'comment text ';

Search annotation Syntax:

Select comments from user_tab_comments where table_name = 'aname' -- note that the table name in quotation marks must be in uppercase.

 

Take the table Arwen as an example:

Comment on table Arwen is 'this table include info about arwen'; -- add comments

Select comments from user_tab_comments where table_name = 'arwen'; -- Query annotation information

 

2. Add comments to the column:

 

Syntax:

Comment on column table_name.column_name is 'comments text ';

Select comments from user_col_comments where table_name = 'aname' and column_name = 'aname ';

 

Take the column ename In the table Arwen as an example:

Comment on column Arwen. ename is 'the person name ';

Select comments from user_col_comments where table_name = 'arwen' and column_name = 'ename ';

 

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.