DROP KEYSPACE

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

The DROP KEYSPACE statement removes a keyspace and all its database objects (such as tables or types) 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

CREATE KEYSPACEUSEOther CQL Statements