0% found this document useful (0 votes)
322 views

Module 8 Assignment

The document provides instructions for a Module 8 assignment involving creating and using materialized views in DB2. Students are asked to: 1. Create two materialized views aggregating sales data from 2011 and 2012 respectively 2. Rewrite two queries from previous assignments to use the materialized views instead of accessing the fact and dimension tables directly. Students will be graded 50% based on providing the SQL statements and partial results and 50% based on a quiz testing their understanding of using materialized views to optimize queries. They should upload their SQL statements and execution results for grading.

Uploaded by

Eley Cueto
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
322 views

Module 8 Assignment

The document provides instructions for a Module 8 assignment involving creating and using materialized views in DB2. Students are asked to: 1. Create two materialized views aggregating sales data from 2011 and 2012 respectively 2. Rewrite two queries from previous assignments to use the materialized views instead of accessing the fact and dimension tables directly. Students will be graded 50% based on providing the SQL statements and partial results and 50% based on a quiz testing their understanding of using materialized views to optimize queries. They should upload their SQL statements and execution results for grading.

Uploaded by

Eley Cueto
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Module 8 Assignment

The Module 4 Assignment provides experience creating and manipulating materialized

views in DB2. You will create several materialized views and apply the matching process to

rewrite several queries using the materialized views.

You will use the Inventory Data Warehouse in the module 8 assignment. Other

documents provide details about the Inventory Data Warehouse. The Inventory Data Warehouse

design and rows are identical from module 5. If you added rows through the data integration

assignment in module 5, you should remove those rows or just recreate and repopulate the tables.

1. Create Materialized View for 2011 Shipments


Write a CREATE MATERIALIZED VIEW statement according to the following

specifications:

 The result should contain the sum of the extended cost, the sum of the quantity,

and the count of inventory transactions.

 These calculated amounts should be summarized by the customer vendor key and

the date key.

 The result should include only sales shipment transactions (transaction type 5) for

the year 2011.

 The materialized view should not contain subtotals that are created by the CUBE

and the ROLLUP keywords.

 To make the peer assessment easier, you should name your materialized view

“SalesByVendorDateKeyMV2011”.

2. Create Materialized View for 2012 Shipments


Write a CREATE MATERIALIZED VIEW statement according to the following

specifications:
10/10/2019 Module 4 Assignment Page 2

 The result should contain the sum of the extended cost, the sum of the quantity,

and the count of inventory transactions.

 These calculated amounts should be summarized by the customer vendor key and

the date key.

 The result should include only sales shipment transactions (transaction type 5) for

the year 2012.

 The materialized view should not contain subtotals that are created by the CUBE

and the ROLLUP keywords.

 To make the peer assessment easier, you should name your materialized view

“SalesByVendorDateKeyMV2012”.

3. Rewrite Query 1 of the Module 8 Assignment


Using the materialized views that you created in problems 1 and 2, you should rewrite

query 1 from the module 8 assignment. After you submit the module 8 assignment, you will have

access to the solution as part of the peer assessment. You should rewrite query 1 using the

materialized views to replace the fact table and possibly dimension tables. You should not use a

CREATE VIEW statement in your solution. For ease of reference, here are the requirements for

query 1 of the module 8 assignment.

Write an SQL statement to display the sum of the extended cost and the sum of the

quantity. The results should include data for shipments (transaction type 5) in calendar year 2011.

Summarize the result by calendar month and Address Category Code 1. The result should include

the full set of subtotals for every combination of grouped fields.


10/10/2019 Module 4 Assignment Page 3

4. Rewrite Query 2 of the Module 2 Assignment


Using the materialized views that you created in problems 1 and 2, you should rewrite

query 2 from the module 2 assignment. After you submit the module 2 assignment, you will have

access to the solution as part of the peer assessment. You should rewrite query 2 using the

materialized views to replace the fact table and possibly dimension tables. You can use either the

CUBE or GROUPING SETS operator in your solution. You should not use a CREATE VIEW

statement in your solution. For ease of reference, here are the requirements for query 2 of the

module 2 assignment.

Write an SQL statement to display the sum of the extended cost and the number of

inventory transactions. The results should include data for shipments (transaction type 5) in

calendar years 2011 and 2012. Summarize the result by calendar quarter, customer zip code, and

customer name. The result should include the grouped columns and the full set of subtotals for

every combination of grouped columns.

Grading
Your performance will be assessed by a quiz designed to test your understanding of each
problem and by evidence of query executions. Since some quiz questions involve execution
results, you should execute your statements using the original inventory data warehouse tables.

 You will receive 50% if your documentation contains SQL statements and partial results
for each problem. Execution of your SQL statements demonstrates correct syntax.

 The quiz score will provide the other 50% of your grade. The quiz contains questions
about the important elements of each problem such as the usage of the correct tables,
function, partitioning, and sorting.

Completion
You should upload a file containing your DB2 statements and execution results to the

graded item in module 8. For the execution results, you should take a snapshot of the script
10/10/2019 Module 4 Assignment Page 4

output window in Data Studio showing the execution results. For problems 3 and 4, you only

need to show the first 10 rows or so of the result. You should paste the execution results after the

associated SQL statement.

You might also like