Deleting values from a column or entire row
CQL provides the DELETE
statement to delete a column or row.
Deleted values are removed completely by the first compaction following deletion.
Procedure
-
Delete the value of the column
lastname
from the tablecyclist_name
.DELETE lastname FROM cycling.cyclist_name WHERE id = c7fceba0-c141-4207-9494-a29f9809de6f;
-
Delete entire row for a particular race from the table
calendar
.DELETE FROM cycling.calendar WHERE race_id = 201;
You can also define a Time-To-Live value for an individual column or an entire table. This property causes the database to delete the data automatically after a certain amount of time has elapsed. For details, see Expiring data with Time-To-Live.