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

For a column of values [10, 10, 20, 30], how do RANK() and DENSE_RANK() assign a number to the value 20 (ordered ascending)?

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);