Advanced SQL

Top N per group, duplicates, gaps and islands, pivots and hierarchies.

6 notes

Notes

SQL

Top N Per Group

Three ways to get the best row in each group - window function, correlated subquery and lateral join - and how to pick between them.

Read more