Skip to main content

Documentation Index

Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Adds, modifies, or removes a table comment, regardless of whether it was set before or not. The comment change is reflected in both system.tables and in the SHOW CREATE TABLE query.

Syntax

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

Examples

To create a table with a comment:
CREATE TABLE table_with_comment
(
    `k` UInt64,
    `s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';
To modify the table comment:
ALTER TABLE table_with_comment 
MODIFY COMMENT 'new comment on a table';
To view the modified comment:
Query
SELECT comment 
FROM system.tables 
WHERE database = currentDatabase() AND name = 'table_with_comment';
Response
┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘
To remove the table comment:
ALTER TABLE table_with_comment MODIFY COMMENT '';
To verify that the comment was removed:
Query
SELECT comment 
FROM system.tables 
WHERE database = currentDatabase() AND name = 'table_with_comment';
Response
┌─comment─┐
│         │
└─────────┘

Caveats

For Replicated tables, the comment can be different on different replicas. Modifying the comment applies to a single replica. The feature is available since version 23.9. It does not work in previous ClickHouse versions.