Deleting columns and rows

Using 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. Deletes user jsmith's session token column.
    cqlsh:demodb> DELETE session_token FROM users where pk = 'jsmith';
  2. Delete jsmith's entire row.
    cqlsh:demodb> DELETE FROM users where pk = 'jsmith';
    You can also define a Time To Live value for an individual column or an entire table. This property causes Apache Cassandra to delete the data automatically after a certain amount of time has elapsed. For details, see Expiring data with Time-To-Live.