Skip to main content
Skip to main content
Edit this page

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:

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

To modify the comment:

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

To view the modified comment:

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

To remove the database comment:

ALTER DATABASE database_with_comment 
MODIFY COMMENT '';

To verify that the comment was removed:

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