COMMENT ON Statement
The COMMENT ON
statement is used to add or modify comments on database objects, such as tables and columns. This helps document the purpose and details of each object.
Example: Commenting on a Column
COMMENT ON COLUMN FreedomFighters.Contribution IS 'Contribution made by the freedom fighter';
Output:
Comment added successfully to Contribution
column.
Do's and Don'ts
Do's
- Use
COMMENT ON
to describe the purpose and usage of each column clearly. - Keep comments up to date with any schema changes.
- Document key constraints and relationships for better understanding.
Don'ts
- Don't use vague or ambiguous comments that add little value.
- Don't forget to communicate schema updates and new comments to your team.
- Don't rely solely on comments; ensure your schema design is intuitive.