OLAP Operation Types – HackerRank Solution

In this post, we will solve OLAP Operation Types HackerRank Solution. This problem (OLAP Operation Types) is a part of HackerRank Databases series.

Task

Consider a fact table DataPoints(D1,D2,D3,x), and the following three queries:

Q1: Select D1,D2,D3,Sum(x) From DataPoints Group By D1,D2,D3

Q2: Select D1,D2,D3,Sum(x) From DataPoints Group By D1,D2,D3 WITH CUBE

Q3: Select D1,D2,D3,Sum(x) From DataPoints Group By D1,D2,D3 WITH ROLLUP

Suppose attributes D1, D2, and D3 have n1, n2, and n3 different values respectively, and assume that each possible combination of values appears at least once in the table DataPoints. The number of tuples in the result of each of the three queries above can be specified as an arithmetic formula involving n1, n2, and n3. Pick the one tuple (a,b,c,d,e,f) in the list below such that when n1=a, n2=b, and n3=c, then the result sizes of queries Q1, Q2, and Q3 are d, e, and f respectively.

Solution – OLAP Operation Types – HackerRank Solution

Correct Answer – (4, 7, 3, 84, 160, 117)

Note: This problem (OLAP Operation Types) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

1 thought on “OLAP Operation Types – HackerRank Solution”

Leave a Comment

Your email address will not be published. Required fields are marked *