Pagination

SQL Query Patterns: Duplicates, Top-N, and Running Totals

A handful of everyday query problems -- spotting duplicate rows, finding the top result in each group, running totals, month-over-month change, and paging through results safely -- turn out to be the same two SQL tools aimed at different jobs. This guide works through all of them on a small food-delivery order log you can regenerate yourself.

July 18, 2026 in SQL by Mehdi Lotfinejad14 minutes