EMC Proven Professional – Data Science and Big Data Analytics — Question 16

Review the following code:
SELECT pn, vn, sum(prc*qty)

FROM sale -
GROUP BY CUBE(pn, vn)
ORDER BY 1, 2, 3;
Which combination of subtotals do you expect to be returned by the query?

Answer options

Correct answer: D

Explanation

The correct answer is D because the CUBE function generates subtotals for every combination of the specified columns. This includes the full combination (pn, vn), individual column totals (pn and vn), and an overall total, represented as an empty grouping ( ). Options A, B, and C do not account for the overall total that CUBE provides.