Skip to Content
Developer GuideSQL GrammarCreate Database

Create Database

Basic Syntax:

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

To avoid an error when the database already exists, you can specify the IF NOT EXISTS keyword. If specified, executing the statement repeatedly will not produce an error and will not recreate the database.

ON CLUSTER: Used to specify the cluster name. For example, the default cluster name for the cloud data warehouse UClickhouse is ck_cluster.

Example:

CREATE DATABASE ck_test ON CLUSTER ck_cluster;