---
title: "DROP KEYSPACE"
url: "https://docs.yugabyte.com/stable/api/ycql/ddl_drop_keyspace/"
---

# DROP KEYSPACE

Use the DROP KEYSPACE statement to remove a keyspace from the system.

## Synopsis

Use the `DROP KEYSPACE` statement to remove a keyspace from the system.

## Syntax

### Diagram

DROPKEYSPACESCHEMAIFEXISTS[keyspace\_name](/stable/api/ycql/grammar_diagrams#keyspace-name)

### Grammar

```ebnf
drop_keyspace ::= DROP { KEYSPACE | SCHEMA } [ IF EXISTS ] keyspace_name;
```

Where

- `keyspace_name` is an identifier.

## Semantics

- An error is raised if the specified `keyspace_name` does not exist unless `IF EXISTS` option is present.
- An error is raised if the specified keyspace is non-empty (contains tables or types).

## Examples

```sql
ycqlsh> CREATE KEYSPACE example;
```

```sql
ycqlsh> DROP KEYSPACE example;
```

```sql
ycqlsh> DROP KEYSPACE IF EXISTS example;
```

## See also

- [ALTER KEYSPACE](/stable/api/ycql/ddl_alter_keyspace "ALTER KEYSPACE")
- [CREATE KEYSPACE](/stable/api/ycql/ddl_create_keyspace "CREATE KEYSPACE")
- [USE](/stable/api/ycql/ddl_use "USE")
