Collections in inserts

So far, all the examples we saw of collection manipulation have used the UPDATE and DELETE statements. It is possible to write the full value of a collection in an INSERT statement as well, by simply providing a literal representation of the collection's contents:

INSERT INTO "users" (
  "username", "email", "encrypted_password",
  "social_identities", "version"
) VALUES (
  'ivan',
  'ivan@gmail.com',
  0x48acb738ece5780f37b626a0cb64928b,
  {'twitter': 875958, 'instagram': 109550},
  NOW()
);

The INSERT statement does not, however, support discrete updates. As we explored in the previous chapter, INSERT and UPDATE are, at their core, different ways of expressing the same operation. However, in the context of collection manipulation, as ...

Get Learning Apache Cassandra 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.