Skip to main content
← Back to Code Arena
Medium Apprentice SpeedRun window-functions rank analytics

SQL: RANK() With Ties

+200 XP · 8 min · attempt 1

Problem

Table players(name, score) contains:

    Alice  100
    Bob     95
    Carol   95
    Dave    90
    Eve     85

The query:

    SELECT name, RANK() OVER (ORDER BY score DESC) AS r
    FROM players;

What rank value is assigned to Dave? Enter a single integer.

Starter

-- RANK() leaves gaps after ties.
-- DENSE_RANK() does NOT leave gaps. The query uses RANK().

Your answer

Playing as a guest — you'll be asked for a display name on submit. Log in to keep your XP across devices.