Database Tutorial

Course Tutorial Site

Site Admin

Description

without comments

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

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 the rental table.
  • Step 2: Create a MERGE statement that uses the query from Lab #10, Step #2 to merge data into the rental_item table.
  • Step 3: Create a MERGE statement that uses the query from Lab #10, Step #3 to merge data into the transaction table.
  • Step 4: Create a upload_transaction procedure that uses Transaction Control Language (TCL) to control a set of three MERGE statements.
  • Step 5: Create a SELECT statement that uses date functions and aggregation to render a business report.

Written by michaelmclaughlin

August 13th, 2018 at 11:45 am

Posted in