E-commerce & Retail Analytics Path · Mission 14 of 30Medium

Top 3 products per category by revenue

Use ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) to rank within groups, then filter to rank ≤ 3. The Top-N-per-group pattern that's the single most-asked SQL interview question for analyst roles.

The Brief

You'll practice

Top-N per groupROW_NUMBER