SQL pattern · P15 · 18 problems
Learn it first · P15The rank that skips a number after a tieWindow functions and ranking
Graded problems on window functions and ranking, from easy to hard.
18 problems · about 3 h 10 min in all
RANK() leaves a gap after ties, so the third distinct value lands at rank 4, not 3.Read the lesson →Easy
Medium
04ROW_NUMBER vs RANK vs DENSE_RANK on tied amounts8 min →05Each product's share of its category revenue10 min →06Rank products within each order (repeat lines merged)10 min →07Top 3 best-selling products per category10 min →08Top-spending customer per country10 min →09Second-biggest order per customer8 min →10Per-customer median attached to every order row8 min →11Where each salary sits within its department12 min →12Spend quartiles that keep tied customers together12 min →13Compare each order with the customer's other orders12 min →14Top 3 sellers, keeping everyone tied for a place8 min →