Multiple choice technology databases

Merge Syntax

  1. A. MERGE INTO <<target_table_name>> USING <<source_table_name>> WHEN MATCHED THEN UPDATE ------ WHEN NOT MATCHED THEN INSERT -------

  2. B. MERGE <<target_table_name>> USING <<source_table_name>> WHEN MATCHED THEN UPDATE ------ WHEN NOT MATCHED THEN INSERT -------

  3. C. MERGE INTO <<target_table_name>> USING <<source_table_name>> WHEN EXISTS THEN UPDATE ------

  4. D. MERGE INTO <<target_table_name>> USING <<source_table_name>> WHEN NOT MATCHED THEN INSERT ------

  5. Both A and D

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

MERGE syntax requires INTO keyword before the target table, followed by USING and the source table. Option A shows the correct syntax: MERGE INTO target USING source WHEN MATCHED THEN UPDATE WHEN NOT MATCHED THEN INSERT. Option B is missing INTO, C uses wrong clause (EXISTS), D only has INSERT, and E is incorrect.

AI explanation

The standard MERGE syntax is MERGE INTO USING WHEN MATCHED THEN UPDATE ... WHEN NOT MATCHED THEN INSERT ..., combining both matched and unmatched conditions in one statement targeting a named table with INTO. Option B omits the required INTO keyword, and C invents a nonexistent WHEN EXISTS clause, which isn't valid MERGE syntax.