Question:

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

Show Hint

The CUBE operation in OLAP computes aggregates for all combinations of dimension values, including individual dimensions and the overall total.
Updated On: Apr 4, 2025
  • 1
  • 6
  • 9
  • 12
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

The CUBE operation calculates the sum for all combinations of the values of \( D1 \) and \( D2 \), along with their respective totals:

For \( D1 \) with 3 values and \( D2 \) with 2 values, the total number of combinations is \( 3 \times 2 = 6 \).
In addition to these combinations, there are:
2 aggregates over \( D1 \),
3 aggregates over \( D2 \),
1 overall aggregate.

Thus, the total number of tuples is \( 6 + 2 + 3 + 1 = 12 \).
Was this answer helpful?
0
0

Questions Asked in GATE DA exam

View More Questions