04 Laboratory Exercise 1
04 Laboratory Exercise 1
Laboratory Exercise
Rollup and Cube
Objective:
Execute OLAP-type operations using the ROLLUP, CUBE, and PIVOT operators.
Software Requirement:
Procedures:
1. Go to https://sqliteonline.com. In the left-side corner, expand the MS SQL tab then click the Click to
connect.
Note: After 15 minutes of being idle, all data that have been created on the website will be automatically
deleted.
2. Open the text file named Data_Insert 1. Execute the following commands by copying the contents of
the file and pasting it to the query section of the website then click Run. The commands that have been
executed will automatically insert the data that will be used for this exercise. See the table below.
Table 1. Purchase_Items
3. Using the ROLLUP operator, write queries that will compute the total amount of the items
purchased per brand and its grand total. See the output below.
Output:
4. Using the ROLLUP operator, write queries that will compute all the item purchased per brand
and per month, as well as its grand total of all purchased items in all date.
Output:
5. Using the CUBE operator, write queries that will do the following:
5.1. Display the item purchased per brand and its month. Compute the grand total per
brand, and the grand total for all items.
5.2. Display the total amount of all items purchased each month. See the output below.
Output:
GRADING RUBRIC:
CRITERIA PERFORMANCE INDICATORS POINTS
Correctness The code produces the expected result. 30
Logic The code meets the specifications of the problem. 30
Efficiency The code is concise without sacrificing correctness and logic. 20
Syntax The code adheres to the rules of the database management system. 20
Total 100