MERGE INTO target_table AS tUSING source_table AS sON t.id = s.idWHEN MATCHED THEN UPDATE SET column1 = s.column1WHEN NOT MATCHED THEN INSERT (column1, column2) VALUES (s.column1, s.column2);