Analysis of Percentage
-- Analysis of Percentage can be done using 
-- SUM() OVER() and SUM() OVER(ORDER BY ) 
-- syntax as shown below. Also shown are
-- cummulative (running total for value)
-- totals and percentage. 
-- COUNT(*) OVER() gets the total row count.


WITH q_data AS (
 SELECT
  level idx,
  COUNT(*) OVER() cnts,
  SUM(level) OVER() total
 FROM DUAL
 CONNECT BY level <= 10)
SELECT
 idx,
 SUM(idx) OVER(ORDER BY idx) cum_total,
 ROUND(100*idx/total,4)  idx_percent,
 ROUND(SUM(100*idx/total)
       OVER(ORDER BY idx),4) cum_percent,
 cnts total_row_cnt
FROM q_data
;

Analysis of Percentage

Cummulative (Running) Totals Computation

Cummulative (Running) Total Sales Computation

Oracle registered trademark of Oracle Corporation.

Last Revised On: November 10th, 2013

  3091