ClickHouse/docs/en/sql-reference/statements/alter/comment.md
Dmitriy bd355bd727 Fix link
Поправил ссылку.
2021-11-05 21:13:46 +03:00

1.4 KiB

toc_priority toc_title
51 COMMENT

ALTER TABLE … MODIFY COMMENT

Adds, modifies, or removes comment on existing table, regardless if it was set before or not. Comment change is reflected in both system.tables and SHOW CREATE TABLE query.

Syntax

ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY COMMENT 'Comment'

Examples

Creating a table with comment (for more information, see the COMMENT Clause):

CREATE TABLE table_with_comment
(
    `k` UInt64,
    `s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';

Modifying the table comment:

ALTER TABLE table_with_comment MODIFY COMMENT 'new comment on a table';
SELECT comment FROM system.tables WHERE database = currentDatabase() and name = 'table_with_comment';

Output of a new comment:

┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘

Removing the table comment:

ALTER TABLE table_with_comment MODIFY COMMENT '';
SELECT comment FROM system.tables WHERE database = currentDatabase() and name = 'table_with_comment';

Output of a removed comment:

┌─comment─┐
│         │
└─────────┘