cube oracle

Solutions on MaxInterview for cube oracle by the best coders in the world

showing results for - "cube oracle"
Sakina
12 Jul 2017
1-- In addition to the regular aggregation results we expect from the
2-- GROUP BY clause, the ROLLUP extension produces group subtotals from 
3-- right to left and a grand total. If "n" is the number of 
4-- columns listed in the ROLLUP, there will be n+1 levels of subtotals.
5
6SELECT fact_1_id,
7       fact_2_id,
8       fact_3_id,
9       SUM(sales_value) AS sales_value
10FROM   dimension_tab
11GROUP BY ROLLUP (fact_1_id, fact_2_id, fact_3_id)
12ORDER BY fact_1_id, fact_2_id, fact_3_id;
13
14
15
16
17
18
19
20
Luann
06 Feb 2020
1 -- the CUBE extension will generate subtotals for all combinations of the 
2 -- dimensions specified. If "n" is the number of columns listed in the CUBE,
3 -- there will be 2^n subtotal combinations.
4 
5 SELECT fact_1_id,
6       fact_2_id,
7       fact_3_id,
8       SUM(sales_value) AS sales_value
9FROM   dimension_tab
10GROUP BY CUBE (fact_1_id, fact_2_id, fact_3_id)
11ORDER BY fact_1_id, fact_2_id, fact_3_id;
12