Syntactic sugar for deletion

Although Cassandra doesn't have real NULL columns, CQL does provide some syntactic sugar to provide a more familiar interface to remove data from columns. You can, in fact, write UPDATE statements that set values to null:

UPDATE "users" SET "location" = NULL WHERE "username" = 'alice'; 

Note that this is purely syntactic sugar; the preceding statement is precisely the same operation as the following one:

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

The DELETE form of the statement is more expressive of what we are actually doing—removing a value from a column—but the UPDATE form is more familiar to anyone used to working with SQL. Another advantage of the UPDATE statement is that we can write ...

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.