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

  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 = 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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com