16. RANK vs DENSE_RANK
EasyRankingRANKDENSE_RANKtie handling
RANK leaves gaps after ties (1, 2, 2, 4) while DENSE_RANK
does not (1, 2, 2, 3). Seeing them side by side makes the difference obvious.
Task: return player, score, rnk (RANK) and drnk
(DENSE_RANK), both ordered by score descending. Order the output by score
descending, then player.
Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.
SQL· SQLite · runs in your browser
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.