Multiple choice technology databases

Consider this syntax MERGE INTO t1 USING t2 ON (join predicate) .... What does the MERGE syntax do ?

  1. It performs a merge join of the row from T2 only if it does'nt exist in the T1 table.

  2. It creates a natural join of table T1 and T2 for all columns that have the same name.

  3. It creates a Cartesian prodcut of table T1 and table T2 for all columns that have the same name.

  4. For each row from T2, it updates the row if it exists witin table T1, otherwise it inserts the row into T1.

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

The MERGE statement (also called UPSERT) combines UPDATE and INSERT operations. For each row from the source table T2, it evaluates the join predicate against T1. If a matching row exists in T1, it updates that row; if no match exists, it inserts the new row into T1.