Removing a value from a column
Let's say bob
decides he doesn't want his location on his profile. We'd like to get the location
column back to the state it was in earlier, which appears as null
in cqlsh
but simply means "no data here".
Missing columns in Cassandra
As we discussed previously, Cassandra doesn't have the concept of NULL
columns in the SQL sense. Concretely, the following statement is not possible in Cassandra:
SELECT * FROM "users" WHERE "location" IS NULL;
Relational databases typically store a separate bit in each column to indicate whether that column contains a NULL
value. In Cassandra, on the other hand, all data columns are optional, and only the columns with a value are represented in storage. We can visualize Cassandra rows as maps of key-value pairs, with some keys possibly missing; relational database rows are more like fixed size lists of columns, where some columns may have a NULL
value. The following diagram shows how we might visualize dave
's row in Cassandra, and...