ClickHouse/docs/en/sql-reference/statements/create/database.md
2021-05-27 21:44:11 +02:00

996 B
Raw Blame History

toc_priority toc_title
35 DATABASE

CREATE DATABASE

Creates a new database.

CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)]

Clauses

IF NOT EXISTS

If the db_name database already exists, then ClickHouse does not create a new database and:

  • Doesnt throw an exception if clause is specified.
  • Throws an exception if clause isnt specified.

ON CLUSTER

ClickHouse creates the db_name database on all the servers of a specified cluster. More details in a Distributed DDL article.

ENGINE

MySQL allows you to retrieve data from the remote MySQL server. By default, ClickHouse uses its own database engine. Theres also a lazy engine.