Deleting values from a column or entire row

Use the DELETE statement to replace the value in a column with null or to remove an entire row of data.

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

Procedure

  1. Delete the value of the column lastname from the table cyclist_name.
    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.
    DELETE
    FROM cycling.calendar
    WHERE race_id = 200;
    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.