MSSQLWindow FunctionsDENSE_RANK
RANK

DENSE_RANKWindow Functions

PERCENT_RANK

Assigns the same rank to equal values, without gaps in ranking.

Syntax

DENSE_RANK() OVER (w)

Example

Enter values below to update the example in real time.

student_id
score
exam_results
SELECT student_id, score,
       DENSE_RANK() OVER (ORDER BY score DESC) AS rank
FROM exam_results;