COMMENT
Week #2: Articles
Learning Outcomes
- Learn how to comment tables.
- Learn how to comment columns.
CREATE
StatementALTER
StatementDROP
StatementRENAME
StatementTRUNCATE
StatementCOMMENT
Statement
COMMENT
tables and columns
This section shows you how to comment tables and columns.
Instruction Details →
The COMMENT
statement provides you with the ability to place comments on tables, columns, operators, indextypes, materialized views, and mining models. The prototype for the COMMENT
command is
COMMENT ON {TABLE schema_name.{table_name | view_name} |COLUMN schema_name.{table_name | view_name | materialized_view_name}.column_name} |OPERATOR schema_name.OPERATOR |INDEXTYPE schema_name.INDEXTYPE |MATERIALIZED VIEW materialized_view_name |MINING MODEL schema_name.model} IS 'comment'; |
You would add a comment to the item table with the following syntax:
SQL> COMMENT ON TABLE item 2 IS 'Video Store Items.'; |
You add a comment to the item_title column of the item table with this:
SQL> COMMENT ON COLUMN 2 item.item_title IS 'A Video Item Title.'; |
It’s helpful to provide comments generally, but it’s critical when the column or table has special meaning or purpose in the context of your data model. The same can be said for operators, index types, materialized views (like the periodicity of refresh), and mining models. I strongly recommend the use of comments to document your data models.