CREATE DATABASE

Applies to: ❌ Data Cloud SQL ✅ Tableau Hyper API

Create a new database.

CREATE DATABASE creates a new Hyper database.

IF NOT EXISTS

Do not throw an error if the database cannot be created because a database file with the same name already exists. Even with IF NOT EXISTS, the CREATE TABLE command fails if the already existing file is not a Hyper database file.

<name>

The name of the database to create. The new database will be stored as a file with this name in the default database directory. No default file extension is added, but one can be provided as part of the name. Alternatively, this parameter can also be an absolute or relative path to where the database file should be stored. See examples below.

<source_database>

If the FROM clause is specified, then the new database will contain a copy of the source database, including the content of all tables and all metadata.

To create a new database:

To create a new database at the specified absolute file path (assuming not restricted to the default database directory):

To create a new database under a specified file path relative to the default database directory:

To copy a database sales into a new database sales_copy:

There is no CREATE DATABASE statement in the SQL standard. Databases are equivalent to the concept of catalogs, whose creation the SQL standard leaves to the application.