Deleting columns and rows

How to use the DELETE command to delete a column or row.

CQL provides the DELETE command to delete a column or row. Deleted values are removed completely by the first compaction following deletion.

Procedure

  1. Delete the values of the column lastname from the table cyclist_name.
    cqlsh> DELETE lastname FROM cycling.cyclist_name WHERE id = c7fceba0-c141-4207-9494-a29f9809de6f;
  2. Delete entire row for a particular race from the table calendar.
    cqlsh> DELETE FROM cycling.calendar WHERE race_id = 200;
    You can also define a Time To Livevalue for an individual column or an entire table. This property causes Cassandra to delete the data automatically after a certain amount of time has elapsed. For details, see Expiring data with Time-To-Live.