DROP KEYSPACE

Synopsis

The DROP KEYSPACE statement removes a keyspace from the system.

Syntax

Diagram

DROP KEYSPACE - 图1

Grammar

  1. 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

You can do this as shown below.

  1. cqlsh> CREATE KEYSPACE example;
  1. cqlsh> DROP KEYSPACE example;
  1. cqlsh> DROP KEYSPACE IF EXISTS example;

See also