Questions: Ranking Functions: ROW_NUMBER, RANK, DENSE_RANK

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Four students take an exam: Alice scores 95, Bob scores 92, Carol scores 92, Dave scores 88. Using DENSE_RANK() ORDER BY score DESC, what ranks are assigned?

AAlice=1, Bob=2, Carol=3, Dave=4
BAlice=1, Bob=2, Carol=2, Dave=4
CAlice=1, Bob=2, Carol=2, Dave=3
DAlice=1, Bob=3, Carol=3, Dave=4
Question 2 Multiple Choice

You want to deduplicate a customer table by keeping exactly one row per customer — the most recently updated record. Which ranking function is most appropriate and why?

ARANK(), because it handles ties by assigning the same rank to duplicates
BDENSE_RANK(), because it produces consecutive integers that make filtering easy
CROW_NUMBER(), because it guarantees exactly one row receives rank 1 per partition
DAny of the three work equally well for this use case
Question 3 True / False

When two rows have identical values in the ORDER BY clause, both RANK and DENSE_RANK will assign them the same rank number.

TTrue
FFalse
Question 4 True / False

Adding a PARTITION BY clause to a ranking window function causes most rows in the entire query result to share a single global rank sequence.

TTrue
FFalse
Question 5 Short Answer

What is the practical difference between RANK and DENSE_RANK, and in what scenario would each be the more appropriate choice?

Think about your answer, then reveal below.