Removing values from maps

Continuing the parallels, we can remove a value from a map using the DELETE statement, in a way similar to removing items from a list by index:

DELETE "social_identities"['instagram'] FROM "users" WHERE "username" = 'alice'; 

On checking the table again, we can see that the Instagram key-value pair has been removed:

For further reference on the uses of CQL collections, refer to the DataStax CQL documentation at http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_collections_c.html. Collection manipulation operations are documented with the UPDATE statement at http://www.datastax.com/documentation/cql/3.3/cql/cql_reference/update_r.html ...

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.