What You’ll Learn: Work with and manipulate the data from the previous unit with an overview of using CQL to UPDATE and DELETE the data in your Cassandra instance.


Because Cassandra never does a read before a write, INSERT and UPDATE in Cassandra are actually both “upserts”. INSERT and UPDATE both set the column values regardless of whether the data already exists.

Use the UPDATE command to update the change of a user, specifying the primary key. We are setting the user’s city from “Beverly Hills” to “San Jose”:

cqlsh:demo> UPDATE users SET city= ‘San Jose’ WHERE lastname= ‘Doe’;

Lets take a look at the change we’ve made:

cqlsh:demo> SELECT * FROM users where lastname= ‘Doe’;

You should see:




  • We can delete a row of data using the DELETE command:

cqlsh:demo> DELETE from users WHERE lastname = “Doe”;


  • Check and see that this row of data has been removed:

select * FROM users;


Now you should see: