# CREATE DATABASE

## Syntax <a href="#synopsis" id="synopsis"></a>

```sql
CREATE DATABASE database_name;
```

## Description <a href="#description" id="description"></a>

Similar to other relational databases, a [database](/overview/core-concepts/databases.md) is a logical grouping of [schemas](/overview/core-concepts/databases.md#_schema) 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.

{% hint style="warning" %}
**Important** `virtual` is a reserved database name. You cannot create it with this command.
{% endhint %}

## 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:

```sh
<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:

```sh
<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 |
+------------+-------------+------------+-------------------------------+
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/ddl/create-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
