The T-SQL PERCENTILE_CONT function is an analytic function and is used in SQL Server database to calculate a percentile based on a continuous distribution of the column value.
PERCENTILE_CONT Syntax
PERCENTILE_CONT ( numeric_literal )
WITHIN GROUP ( ORDER BY order_by_expression [ ASC | DESC ] )
OVER ( [
PERCENTILE_CONT Example
select b.*,
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY b.id)
OVER (PARTITION BY b.price) AS PercentCount
from books b
order by PercentCount;