cume_dist over : CUME_DIST « Analytical Functions « Oracle PL/SQL Tutorial






SQL> CREATE TABLE sales(
  2    product_id            NUMBER(6),
  3    cid           NUMBER,
  4    time_id               DATE,
  5    sold         NUMBER(3),
  6    amount                NUMBER(10,2),
  7    cost                  NUMBER(10,2)
  8  );

Table created.

SQL>
SQL> select product_id,sum(sold),cume_dist () over (order by sum(sold) asc) as cume_dist
  2  from sales
  3  where to_char(time_id, 'yyyy-mm') = '2001-06'
  4  group by product_id
  5  order by sum(sold) desc;

no rows selected

SQL>
SQL> drop table sales;

Table dropped.








16.9.CUME_DIST
16.9.1.CUME_DIST functions
16.9.2.Use RANK(), PERCENT_RANK(), CUME_DIST()
16.9.3.CUME_DIST() calculates the position of a specified value relative to a group of values.
16.9.4.cume_dist over