Check out example codes for "cube oracle". It will help you in understanding the concepts better.

Code Example 1

-- In addition to the regular aggregation results we expect from the
-- GROUP BY clause, the ROLLUP extension produces group subtotals from 
-- right to left and a grand total. If "n" is the number of 
-- columns listed in the ROLLUP, there will be n+1 levels of subtotals.

SELECT fact_1_id,
       fact_2_id,
       fact_3_id,
       SUM(sales_value) AS sales_value
FROM   dimension_tab
GROUP BY ROLLUP (fact_1_id, fact_2_id, fact_3_id)
ORDER BY fact_1_id, fact_2_id, fact_3_id;

Code Example 2

-- the CUBE extension will generate subtotals for all combinations of the 
 -- dimensions specified. If "n" is the number of columns listed in the CUBE,
 -- there will be 2^n subtotal combinations.
 
 SELECT fact_1_id,
       fact_2_id,
       fact_3_id,
       SUM(sales_value) AS sales_value
FROM   dimension_tab
GROUP BY CUBE (fact_1_id, fact_2_id, fact_3_id)
ORDER BY fact_1_id, fact_2_id, fact_3_id;

Learn ReactJs, React Native from akashmittal.com