QuestionQ16

VerifiedExecuting queries using Databricks SQL and Databricks SQL Warehouses

A data analyst is performing a complex aggregation on a table containing zero null values, and the query produces the following result:

Question Image

Which of the following queries did the analyst execute to produce this result?

Explanation

GROUP BY group_1, group_2 WITH CUBE generates every grouping combination for the two columns: the detailed groups, subtotals for each group_1, subtotals for each group_2, and the overall total. The null values in subtotal and grand-total rows represent grouping levels generated by the cube, rather than nulls from the input data. A two-column cube is equivalent to GROUPING SETS((group_1, group_2), (group_1), (group_2), ()).

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!