A fact table has dimension D1 with 2 distinct values and D2 with 3 distinct values. Only one combination of (D1, D2) exists in the base table. How many tuples are in the result of GROUP BY CUBE(D1, D2)?
A
Step-by-Step Solution
Key idea: This is a contradiction question—the dimensions have multiple values, but the base table is sparse (only 1 combination exists). We must count tuples per grouping set based on actual data presence.
Step 1: Identify the base table. Only 1 (D1, D2) combination exists, so the base table has 1 tuple.
Step 2: Count tuples per grouping set:
- (D1, D2): 1 tuple (the single base combination)
- (D1): 1 tuple (subtotal for the D1 value present)
- (D2): 1 tuple (subtotal for the D2 value present)
- (): 1 tuple (grand total)
Step 3: Total tuples = .
Answer: 4