Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Module 4 assignment provides practice with SQL statements for data integration. A file in the same website item contains table definitions for the problems.

The Module 4 assignment provides practice with SQL statements for data integration. A file in the same website item contains table definitions for the problems. Problems 1 to 9 involve Oracle SQL for the MERGE and multiple table INSERT statements. Problems 10 to 12 involve the INSERT ... ON CONFLICT statement for PostgreSQL. You are encouraged to use both DBMSs to complete the assignment. If you only have one DBMS installed, you should provide your best solution without execution for statements using the other DBMS.
1. Write an Oracle SQL MERGE statement to combine the SSItem dimension table and the SSItemChanges1 change table. The associated document contains CREATE TABLE and INSERT statements for both tables. Each matching row of SSItemChanges1 contains values for both modified and non-modified columns.
2. Write an Oracle SQL MERGE statement to combine the SSItem dimension table and the SSItemChanges2 change table. The associated document contains CREATE TABLE and INSERT statements for both tables. Each matching row of SSItemChanges2 contains new values for modified columns and null values for non-modified columns.
3. Write an Oracle SQL INSERT ALL statement to insert rows of the ProductSale1 table into four tables (ProductSales2018, ProductSales2019, ProductSales2020, and ProductSales2021). The associated document contains CREATE TABLE and INSERT statements for all tables. Note that the target tables lack the SalesYear column. If SalesYear equals 2018, insert a row into ProductSales2018. The comparisons for the other tables only differ on the SalesYear value and suffix in the name of the target table. You should compute the SalesAmt column in each target table as the sum of the quarter sales (Qtr1, Qtr2, Qtr3, and Qtr4) in the corresponding row of the ProductSale table.
4. On Problem 3, is the number of the rows in the target tables the same when using INSERT FIRST versus INSERT ALL? Justify your answer by writing and executing an INSERT FIRST statement.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions