Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

ALTER DATABASE ... MODIFY COMMENT

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

Syntax

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

Examples

To create a DATABASE with a comment:

Querysql
CREATE DATABASE database_with_comment ENGINE = Memory COMMENT 'The temporary database';

To modify the comment:

Querysql
ALTER DATABASE database_with_comment
MODIFY COMMENT 'new comment on a database';

To view the modified comment:

Querysql
SELECT comment
FROM system.databases
WHERE name = 'database_with_comment';
Responsetext
┌─comment─────────────────┐
│ new comment on database │
└─────────────────────────┘

To remove the database comment:

Querysql
ALTER DATABASE database_with_comment
MODIFY COMMENT '';

To verify that the comment was removed:

Querysql
SELECT comment
FROM system.databases
WHERE  name = 'database_with_comment';
Responsetext
┌─comment─┐
│         │
└─────────┘
Navigation