29 Jan 21 ·  Cpaul in Guides ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Convert MERGE statements from Teradata to BigQuery - Migration Guide

Teradata Merge Statement:

MERGE INTO t1
USING t2
ON a1 = a2
WHEN MATCHED THEN
UPDATE SET b1 = b2
WHEN NOT MATCHED THEN
INSERT (a2, b2, c2);

BigQuery Equivalent

MERGE  t1
USING t2
ON a1 = a2
WHEN MATCHED THEN
UPDATE SET b1 = b2
WHEN NOT MATCHED THEN
INSERT (a2, b2, c2);

The INTO phrase is not required in BigQuery