11 lines
427 B
SQL
11 lines
427 B
SQL
-- bigquery sample SQL
|
|
MERGE dataset.DetailedInventory T
|
|
USING dataset.Inventory S
|
|
ON T.product = S.product
|
|
WHEN NOT MATCHED AND s.quantity < 20 THEN
|
|
INSERT(product, quantity, supply_constrained, comments)
|
|
VALUES(product, quantity, true, ARRAY<STRUCT<created DATE, comment STRING>>[(DATE('2016-01-01'), 'comment1')])
|
|
WHEN NOT MATCHED THEN
|
|
INSERT(product, quantity, supply_constrained)
|
|
VALUES(product, quantity, false)
|
|
; |