
Answer-first summary for fast verification
Answer:
The question requires ranking products within each region by sales without gaps in the ranking. This calls for the DENSE_RANK() window function, which assigns consecutive ranks without gaps when there are ties. The window should be partitioned by region and ordered by sales in descending order (highest sales gets rank 1). Option A uses DENSE_RANK() OVER (PARTITION BY region ORDER BY sales DESC), which correctly partitions by region, orders by sales descending, and provides gapless ranks. The community discussion shows 100% consensus on A, with the comment noting it's the correct interpretation despite some ambiguity. Other options would either create gaps (RANK()), not partition by region, or use incorrect ranking functions.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.