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

> Documentação para ALTER TABLE ... MODIFY COMMENT, que permite adicionar, modificar ou remover comentários da tabela

# ALTER TABLE ... MODIFY COMMENT

Adiciona, modifica ou remove um comentário da tabela, independentemente de ele ter sido definido
anteriormente ou não. A alteração no comentário é refletida tanto em [`system.tables`](/pt-BR/reference/system-tables/tables)
quanto na consulta `SHOW CREATE TABLE`.

<div id="syntax">
  ## Sintaxe
</div>

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

<div id="examples">
  ## Exemplos
</div>

Para criar uma tabela com comentário:

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

Para alterar o comentário da tabela:

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

Para ver o comentário modificado:

```sql title="Consulta" 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 │
└────────────────────────┘
```

Para remover o comentário da tabela:

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

Para verificar se o comentário foi removido:

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

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

<div id="caveats">
  ## Ressalvas
</div>

Para tabelas Replicated, o comentário pode ser diferente entre as réplicas.
A modificação do comentário se aplica a uma única réplica.

O recurso está disponível desde a versão 23.9. Ele não funciona em versões
anteriores do ClickHouse.

<div id="related-content">
  ## Conteúdo relacionado
</div>

* cláusula [`COMMENT`](/pt-BR/reference/statements/create/table#comment-clause)
* [`ALTER DATABASE ... MODIFY COMMENT`](/pt-BR/reference/statements/alter/database-comment)
