Updating multiple rows

As it turns out, bob and carol both live in St. Louis, MO. We could update each of their records individually, but the UPDATE statement also supports the same WHERE...IN construct that we used previously in the SELECT statements, so we can update both of their records in a single query:

UPDATE "users" SET "location" = 'St. Louis, MO' WHERE "username" IN ('bob', 'carol');

Now, on checking the users table again, we'll see that the change was applied to both rows:

While the preceding UPDATE statement allows us to update rows in a single statement, these updates are not isolated; it is possible that while the update is ...

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.