T-SQL Tutorial

T-SQL CUME_DIST


The T-SQL CUME_DIST function is an analytic function and is used in SQL Server database to calculate the relative position of a specified value in a group of values.

CUME_DIST Syntax


CUME_DIST( ) OVER ( [ partition_by_clause ] order_by_clause )



CUME_DIST Example


select b.*,
CUME_DIST () OVER (ORDER BY b.price) AS CumeDist
from books b;