Example

Teradata Vantageā„¢ SQL Functions, Expressions, and Predicates

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

The following SELECT statement:

SELECT lname, serviceyrs,
 CUME_DIST()OVER(ORDER BY serviceyrs)
 FROM schooltbl
 GROUP BY 1,2;

returns the cumulative distribution by service years for teachers listed in schooltbl.

lname serviceyrs CUME_DIST
Adams 10 0.333333
Peters 10 0.333333
Murray 10 0.333333
Rogers 15 0.444333
Franklin 16 0.555333
Smith 20 0.888889
Ford 20 0.888889
Derby 20 0.888889
Baker 20 1.000000