Purpose
You can use this statement to add comments about a table or table column to the data dictionary.
To remove a comment from a database, set it to an empty string ''.
Syntax
/*Add comment to a column.*/
COMMENT ON COLUMN
[ schema. ] { table_name. } column_name IS 'string';
/*Add comment to a table.*/
COMMENT ON TABLE
[ schema. ] table_name IS 'string';
Parameters
| Parameter | Description |
|---|---|
| schema | Specifies the schema. If schema. is omitted, the comment is added to the object (such as a table) in the current schema of the OceanBase database. |
| column_name | The name of the column. |
| table_name | The name of the table. |
| string | Specifies the text of the comment. Setting string to an empty string indicates removing the comment from the database. |
Examples
Add a comment to the
namecolumn of tabletbl1.obclient> COMMENT ON COLUMN tbl1.name IS 'Name of person in table tbl1'; Query OK, 0 rows affectedRemove the comment on the
namecolumn of tabletbl1from the database.obclient> COMMENT ON COLUMN tbl1.name IS ''; Query OK, 0 rows affected