CREATE DATABASE
Use CREATE DATABASE to create a new database.
Syntax
CREATE DATABASE [IF NOT EXISTS] <database_name>;
| Syntax element | Description |
|---|---|
IF NOT EXISTS
|
If specified, do not generate an error if a database of the same name already exists. If not specified, throw an error if a database of the same name already exists. |
<database_name>
|
A name for the database. |
Details
Databases can contain schemas. By default, each database has a schema called
public. For more information about databases, see
Namespaces.
Examples
CREATE DATABASE IF NOT EXISTS my_db;
SHOW DATABASES;
materialize
my_db
Privileges
The privileges required to execute this statement are:
CREATEDBprivileges on the system.