Skip to content

COMMENT

The COMMENT statement adds a comment to a table, table column, or view in the information schema.

Setting a comment to the empty string '' removes the comment.

Syntax

sql
COMMENT ON
  COLUMN 
        { folder.table_name. 
         | folder.view_name.} col_name
  | 
  {TABLE folder.table_name 
   | TABLE folder.view_name }
IS comment;

Parameters

folder: The name of the folder.


table_name, view_name: The name of the table or view to which the comment should be added.


col_name: The name of the column in the table or view to which the comment should be added.


IS comment: Provide the comment text in single quotes.

Usage Notes

A comment can only be added to an object within your folder.

Example 1 | Add a Comment

sql
CREATE TABLE mkw_doku.my_table (my_col INTEGER);
CREATE VIEW  mkw_doku.my_view AS (SELECT * FROM mkw_doku.my_table);

COMMENT ON COLUMN mkw_doku.my_table.my_col IS 'My comment for my_col'; 
COMMENT ON TABLE mkw_doku.my_table IS 'My comment for my_table';       
COMMENT ON TABLE mkw_doku.my_view IS 'My comment for my_view';         
txt
Comment on column 'mkw_doku.my_table.my_col' was created
Comment on table 'mkw_doku.my_table' was created
Comment on table 'mkw_doku.my_view' was created

Example 2 | Remove a Comment

sql
COMMENT ON COLUMN mkw_doku.my_table.my_col IS '';
COMMENT ON TABLE mkw_doku.my_table IS '';
COMMENT ON TABLE mkw_doku.my_view IS '';