# DROP DATABASE

The `DROP DATABASE` command drops a database.

## Syntax

```sql
DROP DATABASE [IF EXISTS] <database_name> [FORCE]

DROP SCHEMA [IF EXISTS] <database_name> [FORCE]

DROP DETACHED DATABASE <database_name> [STORAGEID <storage_id>] [COMPUTEID <compute_id>]

```

> **📝 Note**: The `DROP DETACHED DATABASE` command is a Preview feature.

## Arguments

* `<database_name>`: The name of a SingleStore database.
* `<storage_id>` (Optional): The `STORAGE_ID` extracted from `information_schema.MV_CLOUD_BRANCHES` for the respective database.
* `<compute_id>` (Optional): The `LATEST_COMPUTE_ID` extracted from `information_schema.MV_CLOUD_BRANCHES` for the respective database.

## Remarks

* By default, the `DROP DATABASE` command waits for the running queries to finish before dropping the database. To override this behavior and kill any running queries, use the `FORCE` option.
* This command causes implicit commits. Refer to [COMMIT](https://docs.singlestore.com/cloud/reference/sql-reference/data-manipulation-language-dml/commit.md) for more information.
* The `DROP DATABASE` command cannot be run on [system databases](https://docs.singlestore.com/cloud/reference/system-databases.md).
* The `DROP DATABASE` command drops the Point-In-Time Recovery (PITR) history. A database cannot be restored to the PITR milestone taken before the database was dropped.
* The `DROP DETACHED DATABASE` command drops a database which was previously detached.
* In the `DROP DETACHED DATABASE` command, the `STORAGEID` and `COMPUTEID` clauses apply when multiple entries exist in `information_schema.MV_CLOUD_BRANCHES` for the same database name.
* Refer to the [Permissions Matrix](https://docs.singlestore.com/cloud/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Drop a Database in a Workspace

Within a workspace, you can run `DROP DATABASE` only from the primary R/W database. If a database is detached, you can drop it in the Cloud Portal - under **Databases**, select **Drop Database** from the **Actions** list for the database. When the `DROP DATABASE` command is run on the primary R/W database, the database is dropped from all workspaces, including any read-only copies.

## Examples

```sql
DROP DATABASE IF EXISTS test;

```

```sql
DROP DATABASE IF EXISTS db FORCE;

```

## Example - DROP DETACHED DATABASE

```sql
DROP DETACHED DATABASE testdb;
```

If there are multiple databases with the same name, extract `STORAGE_ID` and `LATEST_COMPUTE_ID`.

```sql
SELECT STORAGE_ID, LATEST_COMPUTE_ID FROM information_schema.MV_CLOUD_BRANCHES
WHERE DATABASE_NAME=‘testdb’;

```

Use the `STORAGE_ID` and `LATEST_COMPUTE_ID` of the detached database in `DROP DETACHED DATABASE` command. Refer to `MV_CLOUD_BRANCHES` for more information.

```sql
DROP DETACHED DATABASE testdb STORAGEID 6362647530070456236:6577025878327007897 COMPUTEID 16245003384144080785:18098;


```

```output

Query OK, 0 rows affected (2.05 sec)

```

***

Modified at: June 11, 2026

Source: [/cloud/reference/sql-reference/data-definition-language-ddl/drop-database/](https://docs.singlestore.com/cloud/reference/sql-reference/data-definition-language-ddl/drop-database/)

(An index of the documentation is available at /llms.txt)
