Description
Lab #11: MERGE
Statement
Learn how to write MERGE
statements with outer-join queries. Typical outer join queries in a MERGE
statement return a surrogate key for a target table when the rows intersect with the transaction table; and the MERGE
statement updates these rows. The outer join queries return a null value when they don’t intersect with the target table; and the MERGE
statement inserts these rows as new rows. Learn how to query aggregated result sets from the transaction
table.
- Lab
- Description
- Help Section
- Instructions
Lab Description
You learn how MERGE
data into a series of tables.
The lab has five parts, which you find after clicking on the Lab Instructions link. The steps are:
- Step 1: Create a
MERGE
statement that uses the query from Lab #10, Step #1 to merge data into therental
table. - Step 2: Create a
MERGE
statement that uses the query from Lab #10, Step #2 to merge data into therental_item
table. - Step 3: Create a
MERGE
statement that uses the query from Lab #10, Step #3 to merge data into thetransaction
table. - Step 4: Create a
upload_transaction
procedure that uses Transaction Control Language (TCL) to control a set of threeMERGE
statements. - Step 5: Create a
SELECT
statement that uses date functions and aggregation to render a business report.