Skip to content

CREATE DATABASE ​

CREATE DATABASE registers a persistent server database. Use USE to select it for later native requests, or choose it through the HTTP database parameter.

This is a server command. An embedded application opens a database with the Connection API instead.

Syntax ​

text
CREATE DATABASE [IF NOT EXISTS] name

Names ​

Names ignore ASCII case. They must begin with an ASCII letter or underscore, contain only ASCII letters, digits and underscores, and have at most 63 characters. system and none are reserved in any letter case.

IF NOT EXISTS allows the command to succeed when the database is already registered. Creating a database does not select it for the connection.

Example ​

Creating a reporting database ​

sql
CREATE DATABASE IF NOT EXISTS reporting;
sql
SELECT name
FROM system.databases
WHERE name = 'reporting'
FORMAT csv;
text
"reporting"

Use SHOW DATABASES or system.databases to inspect the inventory. DROP DATABASE is not an SQL command.