DROP KEYSPACE
This page documents the preview version (v2.23). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.
Synopsis
Use the DROP KEYSPACE
statement to remove a keyspace from the system.
Syntax
Diagram
Grammar
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 unlessIF EXISTS
option is present. - An error is raised if the specified keyspace is non-empty (contains tables or types).
Examples
ycqlsh> CREATE KEYSPACE example;
ycqlsh> DROP KEYSPACE example;
ycqlsh> DROP KEYSPACE IF EXISTS example;