The Cassandra Delete Command is used to delete data from one or more columns. If there is no where clause is specified then it will delete all rows of the table. Once the Delete operation is performed the deleted data is not immediately removed from the disk but marked as delete and based on the grace period it clears.

Delete Table

The Cassandra Delete Command deletes data from one or more columns, or it can delete all rows from the table. The syntax of the Cassandra Delete command is mentioned below.

DELETE column_name
FROM keyspacename.tablename
using timestamp timestamp_value
WHERE pk_columnconditions

In the following example, we will use the where clause to perform a delete operation based on a condition. We are using the delete command using where clause to delete the rows where emp_id=1001.

cqlsh> SELECT * FROM cloudduggu.emp_detail;
cqlsh> DELETE FROM cloudduggu.emp_detail WHERE emp_id=1001;
cqlsh> SELECT * FROM cloudduggu.emp_detail;

Verify Output:

We can verify from the below output that the rows are deleted where emp_id=1001.

cassandra delete output cloudduggu