Purpose
You can use this statement to add comments about tables and table columns to the data dictionary.
To drop a comment from the database, set it to an empty string ''.
Syntax
/*Add a comment to a column.*/
COMMENT ON COLUMN
[ schema. ] { table_name. } column_name IS 'string';
/*Add a comment to a table.*/
COMMENT ON TABLE
[ schema. ] table_name IS 'string';
Parameters
| Parameter | Description |
|---|---|
| schema | The schema. If schema. is omitted, OceanBase Database considers that the objects such as tables for which comments are to be added are in the current schema. |
| column_name | The name of the column. |
| table_name | The name of the table. |
| String | The text of the comment. If you specify an empty string for string, the comment is dropped from the database. |
Examples
Add a comment to the
namecolumn of thetbl1table.obclient> COMMENT ON COLUMN tbl1.name IS 'Name of person in table tbl1'; Query OK, 0 rows affectedDrop the comment from the
namecolumn of thetbl1table in the database.obclient> COMMENT ON COLUMN tbl1.name IS ''; Query OK, 0 rows affected