Creating tables for Oracle database and adding notes to tables and fields

Source: Internet
Author: User

Comment is a keyword for Oracle database system, so it can be used to name an indication or field name

The comment keyword is used to annotate tables and fields, enabling users to understand the structure of a table and the meaning of a database object.

Thirdly, the user can query the data information of the table or field through the data dictionary view, and the corresponding view can be queried as follows:
1. Accessing the user's comment information The data dictionary view to query (the date directory views)
user_tab_comments; Table notes: There are three fields table_name,table_tpye,comments
user_col_comments; table field Note: There are three fields table_name,clumn_name,comments

2. Accessing other user's comment information The data dictionary view to query (the date directory views)
all_tab_comments; Table notes: There are four fields owner,table_name,table_tpye,comments
all_col_comments; table field Note: There are four fields owner,table_name,clumn_name,comments

3. DBA Authority user can access all user's comment information to query the data dictionary view (the date directory views):
dba_tab_comments; Table notes: There are four fields owner,table_name,table_tpye,comments
dba_col_comments; table field Note: There are four fields owner,table_name,clumn_name,comments

Iv. examples of use of comment:
CREATE TABLE Ob_call_date_log

call_id VARCHAR2 (60);
project_id VARCHAR2 (30);
COMMENTS VARCHAR2 (200)


You can write in the SQL script:
SELECT * from ob_call_date_log;//Add notes to Table
Comment on table ob_call_date_log is ' This table is a statement information table '
View notes for a table
SELECT * from user_tab_comments where table_name= ' ob_call_date_log '//Add notes to Column
Comment on Columm ob_call_date_log. PROJECT_ID is ' Project ID '
View column notes this time to label the table name and the column name
SELECT * from user_col_comments where table_name= ' Ob_call_date_log ' and column_name= ' project_id '

This gives you an understanding of the database tables and the fields of the table.

Creating tables for Oracle database and adding notes to tables and fields

Related Article

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.