Search⌘ K
AI Features

CQL DML: DELETE statement

Explore how to use the CQL DELETE statement in Apache Cassandra to delete entire rows or specific columns. Understand tombstones, deletion based on timestamps, and conditional deletes using IF and IF EXISTS clauses, enabling precise control over data removal.

We'll cover the following...

In this lesson, we will focus on the Data Manipulation Language (DML) DELETE operations supported by Apache Cassandra.

The DELETE statement

The DELETE statement is used to either delete a row or data in column(s) of a row. The row to be operated upon is specified in the WHERE clause. The data is not immediately removed. Instead, it is marked as a tombstone and removed after the grace period.

MySQL
DELETE [ column_name ( ',' column_name )* ]
FROM table_name
[ USING TIMESTAMP timestamp_value ]
WHERE PK_column_name = PK_column_value ('AND' PK_column_name = PK_column_value )*
[ IF EXISTS | IF condition ( AND condition)* ]
;

Please refer to syntax conventions for CQL syntax notation details.

If column names are listed after the DELETE keyword, only data in specified column(s) of the selected row are deleted. ...