CREATE DATABASE

更新时间:
复制 MD 格式

Creates a database in ApsaraDB for ClickHouse.

Syntax

CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster];

Parameters

ParameterRequiredDescription
db_nameYesThe database name. Must start with a lowercase letter, contain only letters, digits, and underscores (_), contain no consecutive underscores, and be no longer than 64 characters.
IF NOT EXISTSNoIf a database with the same name already exists, no database is created and no error is returned.
ON CLUSTER clusterNoThe name of the cluster in which to create the database.
system is reserved as the name of the built-in database and cannot be used as db_name.
Note

For ApsaraDB for ClickHouse Enterprise Edition clusters, omit the ON CLUSTER cluster clause.

Example

Create a database named db_001 on the default cluster:

CREATE DATABASE db_001 ON CLUSTER default;