Skip to content
GATEiit

GATE DA 2025 Q46: OLAP: rows returned by GROUP BY CUBE(D1, D2)

Question

Consider a fact table in an OLAP application: Facts(D1, D2, val)\texttt{Facts(D1, D2, val)}, where D1\texttt{D1} and D2\texttt{D2} are its dimension attributes and val\texttt{val} is a dependent attribute. Suppose attribute D1\texttt{D1} takes 3 values and D2\texttt{D2} takes 2 values, and all combinations of these values are present in the table Facts\texttt{Facts}. How many tuples are there in the result of the following query?

SELECT D1, D2, sum(val)
FROM Facts
GROUP BY CUBE (D1, D2);

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: D (official GATE 2025 final answer key)

Concept used: CUBE produces groupings for every subset of the listed dimensions.

First step: CUBE(D1, D2) groups by (D1, D2), (D1), (D2) and (): count the rows each grouping contributes.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 DA question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key