MSSQLWindow FunctionsPERCENTILE_DISC
PERCENTILE_CONT

PERCENTILE_DISCWindow Functions

Returns a percentile based on a discrete distribution.

Syntax

PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY ...)

Example

Enter values below to update the example in real time.

PERCENTILE_DISC
salary
median_disc
employees
SELECT PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY salary) OVER () AS median_disc
FROM employees;