> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 关于 ALTER TABLE ... MODIFY COMMENT 的文档，用于 添加、修改或删除表注释

# ALTER TABLE ... MODIFY COMMENT

添加、修改或删除表注释，无论之前是否已设置注释。

注释的更改会同时反映在 [`system.tables`](/zh/reference/system-tables/tables)
和 `SHOW CREATE TABLE` 查询中。

<div id="syntax">
  ## 语法
</div>

```sql theme={null}
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY COMMENT 'Comment'
```

<div id="examples">
  ## 示例
</div>

要创建带注释的表：

```sql title="Query" theme={null}
CREATE TABLE table_with_comment
(
    `k` UInt64,
    `s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';
```

如需修改表注释：

```sql title="Query" theme={null}
ALTER TABLE table_with_comment 
MODIFY COMMENT 'new comment on a table';
```

要查看修改后的注释：

```sql title="Query" theme={null}
SELECT comment 
FROM system.tables 
WHERE database = currentDatabase() AND name = 'table_with_comment';
```

```text title="Response" theme={null}
┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘
```

要删除表注释：

```sql title="Query" theme={null}
ALTER TABLE table_with_comment MODIFY COMMENT '';
```

要验证该注释已被移除：

```sql title="Query" theme={null}
SELECT comment 
FROM system.tables 
WHERE database = currentDatabase() AND name = 'table_with_comment';
```

```text title="Response" theme={null}
┌─comment─┐
│         │
└─────────┘
```

<div id="caveats">
  ## 注意事项
</div>

对于复制表，不同副本上的注释可以不同。
修改注释仅会应用到单个副本。

该功能自 23.9 版本起可用。在更早的
ClickHouse 版本中无法使用。

<div id="related-content">
  ## 相关内容
</div>

* [`COMMENT`](/zh/reference/statements/create/table#comment-clause) 子句
* [`ALTER DATABASE ... MODIFY COMMENT`](/zh/reference/statements/alter/database-comment)
