Update table command syntax in Google Bigquery

Update a table in Bigquery:

UPDATE dataset.Inventory
SET quantity = quantity - 10
WHERE product like '%washer%';

To update all the rows in a table:

UPDATE dataset.Inventory
SET quantity = quantity - 10
WHERE 1 = 1;

Update from another table in Bigquery:

UPDATE dataset.Inventory i
SET quantity = n.quantity
FROM ( select quantity,product from dataset.NewArrivals )n
WHERE i.product = n.product;

nVector

posted on 27 Sep 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds