ROW_NUMBER, RANK & DENSE_RANK per Group: Ties and Top-n
This lesson is part of the course
In this lesson
You rank coffees inside their category with RANK and DENSE_RANK logic, give every row a unique ROW_NUMBER with a tie-breaker, and flag the top two per category – and see why ties change who is "top 2".
Buy the course once for $9.99 to unlock every lesson and lab, the final exam and the certificate – lifetime access, no subscription.
Lessons in this course
- PARTITION BY vs GROUP BY: Group Totals Next to Every Row Locked
- Running Totals: Cumulative Sums per Customer, Ties & the Running Share Locked
- ROW_NUMBER, RANK & DENSE_RANK per Group: Ties and Top-n Locked
- LAG & LEAD: Previous and Next Order, Gaps and Changes Locked
- Moving Averages & Rolling Windows: Date Ranges vs Row Counts Locked
- NTILE & PERCENT_RANK: Quartiles, Percentiles and Halves per Group Locked
- FIRST_VALUE & LAST_VALUE: First Orders, Cohort Labels and the Latest Row Locked
- Capstone: Sessionisation – Gaps, New-Session Flags and Session Numbers Locked