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 combines INSERT and UPDATE operations in a single statement. For each row in the source table (T2), it checks if a matching row exists in the target table (T1) based on the join condition. If a match exists, it updates the existing row in T1. If no match exists, it inserts a new row into T1. This is an efficient way to synchronize data between tables. Options A, B, and C describe other types of operations (merge join, natural join, Cartesian product) that are not what MERGE does.