이 SQL 문은 이전에 설정되었는지와 관계없이 테이블 주석을 추가, 수정 또는 제거합니다. 주석 변경 사항은 system.tables와
SHOW CREATE TABLE 쿼리 모두에 반영됩니다.
구문
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY COMMENT 'Comment'예시
주석이 있는 테이블을 생성하려면:
CREATE TABLE table_with_comment
(
`k` UInt64,
`s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';테이블 주석을 수정하려면:
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';┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘테이블 주석을 제거하려면:
ALTER TABLE table_with_comment MODIFY COMMENT '';주석이 제거되었는지 확인하려면:
SELECT comment
FROM system.tables
WHERE database = currentDatabase() AND name = 'table_with_comment';┌─comment─┐
│ │
└─────────┘주의사항
복제된 테이블에서는 주석이 레플리카마다 다를 수 있습니다. 주석을 수정해도 단일 레플리카에만 적용됩니다.
이 기능은 버전 23.9부터 사용할 수 있습니다. 이전 ClickHouse 버전에서는 작동하지 않습니다.