Answered step by step
Verified Expert Solution
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 assignment provides practice with SQL statements for data integration. A file in the same website item contains table definitions for the problems. Problems to involve Oracle SQL for the MERGE and multiple table INSERT statements. Problems to 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
Write an Oracle SQL MERGE statement to combine the SSItem dimension table and the SSItemChanges change table. The associated document contains CREATE TABLE and INSERT statements for both tables. Each matching row of SSItemChanges contains values for both modified and nonmodified columns.
Write an Oracle SQL MERGE statement to combine the SSItem dimension table and the SSItemChanges change table. The associated document contains CREATE TABLE and INSERT statements for both tables. Each matching row of SSItemChanges contains new values for modified columns and null values for nonmodified columns.
Write an Oracle SQL INSERT ALL statement to insert rows of the ProductSale table into four tables ProductSales ProductSales ProductSales and ProductSales The associated document contains CREATE TABLE and INSERT statements for all tables. Note that the target tables lack the SalesYear column. If SalesYear equals insert a row into ProductSales 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 Qtr Qtr Qtr and Qtr in the corresponding row of the ProductSale table.
On Problem 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.
Write an Oracle SQL INSERT FIRST statement to insert rows of the ProductSale table into three target tables YearLowSales, YearMidSales, and YearHighSales The associated document contains CREATE TABLE statements for all tables. Insert a row into YearLowSales when annual sales sum of Qtr Qtr Qtr and Qtr are less than Insert a row into YearMidSales when annual sales are greater than or equal and less than Insert remaining rows into YearHighSales. You should compute the SalesAmt column in each target table as the sum of the quarter sales Qtr Qtr Qtr and Qtr in the corresponding row of the ProductSale table.
On Problem 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 ALL statement.
Write an Oracle MERGE statement to combine the MobileBill table with the MobileUsage table matching on CustId. The associated document contains CREATE TABLE statements for both tables. The MobileBill table contains the most recent bill with the current amount CurrentAmt and past amount PastAmt When a match occurs, update the MobileBill.CurrentAmt column as minutes used MobileUsage.MinutesUsed times and the MobileBill.PastAmt column as the previous current amount MobileBill.CurrentAmt plus the previous past amount MobileBill.PastAmt When a match does not occur, insert a row into the MobileBill table with the customer identifier MobileUsage.CustId minutes used MobileUsage.MinutesUsed times and for the past amount MobileBill.PastAmt
Write an Oracle INSERT FIRST statement to insert rows from a mobile customer table MobileCustomer into three tables MobileGold, MobileSilver, and MobileBronze based on a customers current revenue amount MobileCustomer.CurrentAmt The associated document contains CREATE TABLE statements for all tables. If the current revenue amount is greater than or equal to insert the mobile customer row into the MobileGold table. If the current revenue amount is greater than or equal to insert the mobile customer row into the MobileSilver table. Otherwise, insert the mobile customer row into the MobileBronze table.
On Problem 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 ALL statement.
Write a PostgreSQL INSERT CONFLICT ON statement for the requirements in Problem
Write a PostgreSQL INSERT CONFLICT ON statement for the requirements in Problem
Modify the solution to Problem to work with NOT NULL constraints on all columns of SSItem except for ItemId. INSERT statements have been modified in the change table in the associated document. Text columns VARCHAR and CHAR have a value of NV for no value. Numeric columns have a value of for no value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started