Deleting specific columns

To remove data from a column in Cassandra rather than setting it to NULL, we'll want to simply delete it from the column. The syntax for CQL's DELETE statement allows us to do just this by specifying one or more specific columns that we want to delete from:

DELETE "location" FROM "users" WHERE "username" = 'bob';

We can now check the users table again to confirm that bob no longer has a location in his profile:

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.