SQLite CUME_DIST() Function
Example
Return the cumulative distribution of the product prices:
SELECT ProductName, Price,
CUME_DIST() OVER (ORDER BY Price)
FROM Products;
Try it Yourself »
Definition and Usage
The CUME_DIST() function returns the share of the rows that have a value less than or equal to the value of the current row, as a number from 0 to 1.
Note: Window functions need an OVER clause. Read more in the SQLite Window Functions chapter.
Tip: Also look at PERCENT_RANK().
Syntax
CUME_DIST() OVER (ORDER BY column)
Technical Details
| Return type: | Real |
|---|---|
| Works in: | SQLite 3.25.0 and later |