Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CCDS - 2 2 1 Data Warehouse 1 | P a g e Lab # 1 0 This Lab has 2 parts. First, you develop

CCDS-221 Data Warehouse
1| P a g e
Lab # 10
This Lab has 2 parts. First, you develop SQL SLECT statements for OLAP queries in SQL and then, in
the second part you Visualize OLAP Query results as PivotTable using MS-Excel.
Statement purpose
To understand how to develop/simulate OLAP queries using SQL statements and generate
PivotTables to visualize results.
Activity Outcomes
Students will be able to develop SQL statements to simulate OLAP operators (Drill-Down, Roll-Up...)
using aggregate functions.
Instructor Note
Implement each question below and submit its code and result (screenshot) displayed by Oracle.
Tables to use
You will use the Star schema tables (F_ORDERS, D_ORDERS, D_SALESMAN, D_TIME, and
D_CUSTOMERS) created and populated in the previous Labs (Labs 7,8 & 9).
The star schema you will reuse in this lab is remembered in Figure 9(extracted from Lab 8).
Figure 9. Star Schema (Figure 8.2 in Lab 8) implemented in previous labs.
D_CUSTOMERS
ID_C
Gender
C_FName
C_LName
D_TIME
ID_T
Month-No
Quarter Month-Name
D_SALESMAN
ID_S
SName
F_ORDERS
ORDER_AMOUNT
Year
Type
D_ORDERS
ID_O
Status
OMode
Date
University of Jeddah
College of Computer Science &
Engineering
IST Dept.
Academic Year 2020/2021
CCDS-221 Data Warehouse
2| P a g e
Lab 10 Part I
Questions to Answer
Develop a SELECT statement for each of the following requirements:
Querying the Fact only
1. Display the Number of Orders in the D_ORDERS table.
2. Display the Number of Orders in the F_ORDERS table (Check that you get the same number from
the dimension table D_ORDERS).
3. Display the Lowest, Highest and Average Amount of all Orders.
4. For each customer, display the Lowest, Highest and Average Amount of orders.
Query the Fact and one dimension
5. Display the customers(id and Name) having an average Amount of orders greater than the double
of the average amount of all orders.
---> You should get 4 rows.
6. Number of Orders by Salesman (ID_S and SName are required)
---> You should get 4 rows.
7. Number of Orders by customer (Id, FName, LName)
8. Modify your previous answer to display the Number of Orders and their Total by Customer (Id,
FName, LName) sorted by the number of order descending.
9. Display each Customer (Id, C_FName, C_LName) having the total amount of its Orders greater
than 80% of the average of all Orders.
Queries using two dimensions and the fact
10. Display the Number of direct Orders (OMode =DIRECT) by Customer (Id, C_FName, C_LName)
and Salesman (identifier and name).
---> You should get 69 rows.
11. Total Amount of Orders by Year and Customer ID, sorted by Year and Customer.
---> You should get 68 rows
Simulate the Drill-Down operator
12. Transform query 11 to display the result of the following OLAP operation:
DrillDown(Q11, D_Time, Quarter)-- Where Q11 is the result of question 11.
University of Jeddah
College of Computer Science &
Engineering
IST Dept.
Academic Year 2020/2021
CCDS-221 Data Warehouse
3| P a g e
13. Transform query 12 to display the result of the following OLAP operation
DrillDown(Q12, D_Time, Month_No)-- Where Q12 is the result of question 12.
Simulate the Roll-Up operator
Given the Following query QA.
Query QA.
SELECT OMODE, YYEAR, QUARTER, MONTH_NO, SUM (ORDER_AMOUNT) AMOUNT
FROM F_ORDERS, D_TIME, D_ORDERS
WHERE F_ID_T = ID_T
AND F_ID_O = ID_O
GROUP BY OMODE , YYEAR, QUARTER, MONTH_NO;
14. Transform query QA to display the result of the following OLAP Operation:

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions