2021-11-05 16:40:17 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/statements/alter/comment
2022-04-09 13:29:05 +00:00
sidebar_position: 51
sidebar_label: COMMENT
2021-11-05 16:40:17 +00:00
---
2022-06-02 10:55:18 +00:00
# ALTER TABLE … MODIFY COMMENT
2021-11-05 16:40:17 +00:00
2021-11-07 16:04:14 +00:00
Adds, modifies, or removes comment to the table, regardless if it was set before or not. Comment change is reflected in both [system.tables ](../../../operations/system-tables/tables.md ) and `SHOW CREATE TABLE` query.
2021-11-05 16:40:17 +00:00
**Syntax**
``` sql
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY COMMENT 'Comment'
```
**Examples**
2023-03-16 14:04:15 +00:00
Creating a table with comment (for more information, see the [COMMENT ](../../../sql-reference/statements/create/table.md#comment-table ) clause):
2021-11-05 16:40:17 +00:00
``` sql
CREATE TABLE table_with_comment
(
`k` UInt64,
`s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';
```
Modifying the table comment:
``` sql
ALTER TABLE table_with_comment MODIFY COMMENT 'new comment on a table';
2021-11-07 15:08:55 +00:00
SELECT comment FROM system.tables WHERE database = currentDatabase() AND name = 'table_with_comment';
2021-11-05 16:40:17 +00:00
```
Output of a new comment:
```text
┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘
```
Removing the table comment:
``` sql
ALTER TABLE table_with_comment MODIFY COMMENT '';
2021-11-07 15:09:01 +00:00
SELECT comment FROM system.tables WHERE database = currentDatabase() AND name = 'table_with_comment';
2021-11-05 16:40:17 +00:00
```
Output of a removed comment:
```text
┌─comment─┐
│ │
└─────────┘
```