0% found this document useful (0 votes)
9 views2 pages

DBMS Assignment 6

This assignment requires students to submit a Word document containing SQL queries and descriptions of their functions and results, with a total of 100 points available. The objective is to enhance understanding of advanced SQL techniques, including window functions, grouping sets, cube, rollup, and intersect, through various tasks involving complex data aggregations and manipulations. Specific tasks include retrieving transaction amounts, calculating averages, and grouping data by different criteria using advanced SQL operations.

Uploaded by

ilya.siraev.2018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

DBMS Assignment 6

This assignment requires students to submit a Word document containing SQL queries and descriptions of their functions and results, with a total of 100 points available. The objective is to enhance understanding of advanced SQL techniques, including window functions, grouping sets, cube, rollup, and intersect, through various tasks involving complex data aggregations and manipulations. Specific tasks include retrieving transaction amounts, calculating averages, and grouping data by different criteria using advanced SQL operations.

Uploaded by

ilya.siraev.2018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment VI

Submission: See the deadline in Moodle.


Submission format: Word containing SQL queries and textual descriptions of their purpose
and results.

Total points given: 100 pts.

Objective
The goal of this assignment is to enhance students' understanding and proficiency in using
advanced SQL techniques such as window functions, grouping sets, cube, rollup, and
intersect. You will learn to effectively analyze and manipulate data in relational databases
by performing complex aggregations, ranking, and filtering operations across different
groupings and partitions.

Task Requirements

1. Set operations. Advanced grouping


o 1. Retrieve the total transaction amount grouped by merchant city, merchant
state, and zip code using GROUPING SETS. Display the merchant city, state,
zip code, and total transaction amount. Include results for each level of
aggregation.
o 2. Calculate the total and average transaction amounts for each card brand
and card type using CUBE. Display the card brand, card type, total transaction
amount, and average transaction amount. Include all combinations of card
brand and card type.
o 3. Retrieve the total number of transactions and total transaction amount for
each combination of card brand and merchant state using ROLLUP. Display
the card brand, merchant state, number of transactions, and total transaction
amount. Include subtotals and grand totals.
o 4. Calculate the average transaction amount and total transactions for each
MCC description and merchant state using GROUPING SETS. Display the
MCC description, merchant state, average transaction amount, and total
transactions. Include results for each level of aggregation.
o 5. Retrieve the total transaction amount grouped by card brand, merchant
city, and year using CUBE. Display the card brand, merchant city, year, and
total transaction amount. Include results for each combination.
o 6. Retrieve the total yearly income grouped by gender and number of credit
cards using ROLLUP. Display the gender, number of credit cards, and total
yearly income. Include subtotals for each gender.
o 7. Calculate the average and maximum credit limits grouped by card brand
and card type using GROUPING SETS. Display the card brand, card type,
average credit limit, and maximum credit limit. Include results for each level
of aggregation.
o 8. Retrieve the total transaction amount grouped by MCC description and
merchant state using CUBE. Display the MCC description, merchant state,
and total transaction amount. Include all combinations of MCC and merchant
state.
o 9. Calculate the total and average yearly income for each gender and number
of credit cards using GROUPING SETS. Display the gender, number of credit
cards, total yearly income, and average yearly income. Include results for
each level of aggregation.
o 10. Retrieve the total transaction amount grouped by merchant state and card
brand using ROLLUP. Display the merchant state, card brand, and total
transaction amount. Include subtotals for each merchant state.
o Description Requirement: Describe the purpose of the function(s) used in
each query and the expected transformation of the data. (100 pts)

You might also like