DROP KEYSPACE

Synopsis

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

Syntax

Diagram

DROPKEYSPACESCHEMAIFEXISTSkeyspace_name

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 unless IF 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;

See also