Dropping tables and keyspaces
The DROP TABLE statement removes a table and the table data. The
DROP KEYSPACE statement removes the keyspace and all of the objects
in the keyspace.
To remove a table and the table data, use the DROP TABLE
statement.
To remove a keyspace and all of the objects in it, use the DROP
KEYSPACE statement.
To perform the removal only if the object exists, add the IF
EXISTS clause.
-
This
DROP TABLEexample drops therank_by_year_and_nametable:DROP TABLE IF EXISTS cycling.rank_by_year_and_name;
-
This
DROP KEYSPACEexample drops thecyclingkeyspace:DROP KEYSPACE cycling IF EXISTS;
