Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLwindow functions ROW_NUMBER RANKSingle-choice MCQ

Given the values 10, 10, 20, 30 ordered ascending, what does RANK() OVER (ORDER BY v) produce versus DENSE_RANK()?

SELECT v, RANK() OVER (ORDER BY v) AS rnk, DENSE_RANK() OVER (ORDER BY v) AS drnk FROM (VALUES (10),(10),(20),(30)) AS t(v);