Creates a database in ApsaraDB for ClickHouse.
Syntax
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster];Parameters
| Parameter | Required | Description |
|---|---|---|
db_name | Yes | The 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 EXISTS | No | If a database with the same name already exists, no database is created and no error is returned. |
ON CLUSTER cluster | No | The name of the cluster in which to create the database. |
systemis reserved as the name of the built-in database and cannot be used asdb_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;该文章对您有帮助吗?