sqlintermediate
SQL Window Function with CTE
DENSE_RANK partition query ranking top typists per language
By ApeType Staff·14 lines·307 characters·1,420 total attempts
WITH RankedSessions AS (
SELECT
user_id,
language,
wpm,
accuracy,
DENSE_RANK() OVER (
PARTITION BY language
ORDER BY wpm DESC, accuracy DESC
) as rank
FROM session_metrics sm
JOIN practice_sessions ps ON sm.session_id = ps.id
)
SELECT * FROM RankedSessions WHERE rank <= 10;
TRANSCRIBE
Ready when you are.
Test your muscle memory and transcription speed against this exact snippet.
Start Typing
Tip: Press Esc anytime to restart
Best runs on this snippet
| # | Typist | Acc | WPM |
|---|---|---|---|
| 1 | Henok Yoseph | 100% | 75 |
| 2 | Henok Yoseph | 100% | 75 |
| 3 | Henok Yoseph | 100% | 75 |