Updating discrete values in a map

When we allow a user to link up to a new social network, we'd like to be able to add their ID to the social_identities collection without any regard to its current contents. To do so, we use a syntax similar to that of element replacement in a list:

UPDATE "users" SET "social_identities"['instagram'] = 9839025,     "social_identities"['yo'] = 25 WHERE "username" = 'alice'; 

It's also perfectly valid to overwrite a value at an existing key; since keys are unique, the previous value will be replaced with the given one:

UPDATE "users" SET "social_identities"['twitter'] = 2725634 WHERE "username" = 'alice'; 

Checking the value of the map in the alice row, we can confirm that the Twitter ID is the most recently ...

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.