April 2017
Beginner to intermediate
360 pages
9h 35m
English
Elements can be removed from a list, either by value or by index. Removal by value is identical to set removal, other than the literal format:
UPDATE "user_status_updates" SET "shared_by" = "shared_by" - ['carol'] WHERE "username" = 'alice' AND "id" = 76e7a4d0-e796-11e3-90ce-5f98e903bf02;
This will remove all instances of the 'carol' string from the list. To remove an element from the list by index, we use a special form of the DELETE statement:
DELETE "shared_by"[0] FROM "user_status_updates" WHERE "username" = 'alice' AND "id" = 76e7a4d0-e796-11e3-90ce-5f98e903bf02;
Recall from the previous chapter that we can remove data from individual columns in a row by specifying the column names directly after ...
Read now
Unlock full access