Drop Table

The Cassandra Drop Table command is used to drop the table present in the Cassandra database. If there are materialized views associated with the table then we need to drop all those materialized views first then the table otherwise, we will receive the error message InvalidRequest: Error from server: code=2200 Invalid query message="Cannot drop table when materialized views still depend on it.

The following is the syntax of the Cassandra Drop Table command.

DROP TABLE IF EXISTS keyspacename.tablename;

In the following example, we will drop a table named Cloudduggu.emp_name using the Cassandra Drop table command.

cqlsh> DROP  TABLE  cloudduggu.emp_name;


In the below output we can see the table has been dropped.

cassandra drop table command cloudduggu