MERGE statement is used to modify data in a target table based on data in a source table. The statement joins the target to the source by using a column which is common to both the tables. We can INSERT, UPDATE, or DELETE data from the target table-all in one statement-according to how the rows match up as a result of the join. This lab is divided into five exercises explaining different scenarios where MERGE statement is useful such as INSERT and UPDATE the rows using MERGE, UPDATE and DELETE rows using MERGE and INSERT, UPDATE and DELETE rows using MERGE.
Exercise 1: INSERT and UPDATE the rows using MERGE
Exercise 2: UPDATE and DELETE the rows using MERGE
Exercise 3: INSERT, UPDATE and DELETE the rows using MERGE
Exercise 4: Self-Assessment
Exercise 5: T-SQL Challenge