CREATE DATABASE

Syntax

CREATE DATABASE database_name;

Description

Similar to other relational databases, a database is a logical grouping of schemas in DeltaStream. Databases are the foundation for organizing data in DeltaStream and provide the building block of its namespacing model.

You can create databases for logical groupings for different teams or projects. For instance, you can create one database for a logging project and another for an ads team.

Arguments

database_name

Name of the database to create. When a database is created, it automatically includes a public schema in the database. If the new database is the only database in the organization, it's set as default automatically. If the name is case sensitive, you must wrap it in double quotes; otherwise the system uses the lowercase name.

Important virtual is a reserved database name. You cannot create it with this command.

Examples

Create a new database

The following shows how to create a new database. As this is the first database you're creating, DeltaStream automatically sets it as the default for the current organization and uses it for the remainder of the session:

<no-db>/<no-store># CREATE DATABASE demodb;
+------------+---------------+------------+------------------------------------------+
|  Type      |  Name         |  Command   |  Summary                                 |
+============+===============+============+==========================================+
| database   | demodb        | CREATE     | database "demodb" was successfully       |
|            |               |            | created                                  |
+------------+---------------+------------+------------------------------------------+
| schema     | demodb.public | CREATE     | schema "demodb.public" was successfully  |
|            |               |            | created                                  |
+------------+---------------+------------+------------------------------------------+
demodb.public/<no-store># LIST DATABASES;
+-------------+-------------+------------+-------------------------------+
|  Name       |  Is Default |  Owner     |  Created At                   |
+=============+=============+============+===============================+
| demodeb     | true        | sysadmin   | 2024-07-02 21:41:40 +0000 UTC |
+-------------+-------------+------------+-------------------------------+

Create a new case-sensitive database

The following shows how to create a new database. As this is the first database you're creating, DeltaStream automatically sets it as the default for the user account:

<no-db>/<no-store># CREATE DATABASE "DemoDB!";
+------------+----------------+------------+------------------------------------------+
|  Type      |  Name          |  Command   |  Summary                                 |
+============+================+============+==========================================+
| database   | DemoDB!        | CREATE     | database "DemoDB!" was successfully      |
|            |                |            | created                                  |
+------------+----------------+------------+------------------------------------------+
| schema     | DemoDB!.public | CREATE     | schema "DemoDB!.public" was              |
|            |                |            | successfully created                     |
+------------+----------------+------------+------------------------------------------+
DemoDB!.public/<no-store># LIST DATABASES;
+------------+-------------+------------+-------------------------------+
|  Name      |  Is Default |  Owner     |  Created At                   |
+============+=============+============+===============================+
+------------+-------------+------------+-------------------------------+
| DemoDB!    | true        | sysadmin   | 2024-07-02 16:24:11 +0000 UTC |
+------------+-------------+------------+-------------------------------+

Last updated