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 ';