The Cassandra Drop Keyspace is used to dorp a keyspace from the Cassandra. Once the Drop Keyspace is executed, all existing column families, data types, and indexes are deleted.


Cassandra Drop Keyspace

We can use the following Drop command to Drop a Keyspace in Cassandra.

Syntax:
DROP keyspace [ IF EXISTS ] keyspacename

Now let's see an example to drop a keyspace named cloudduggu using the drop keyspace command. First, we will use the describe keyspaces; command to check the existing keyspaces and then we will use the drop keyspace to drop the selected keyspace as mentioned below.


Command:
cqlsh> describe keyspaces;
cqlsh> DROP keyspace cloudduggu;
cqlsh> describe keyspaces;


Output:

In the following output, we can see the keyspace cloudduggu has been dropped.

cassandra drop keyspace cloudduggu