Introduction
PARTITION BY helps you split data into groups to do calculations on each group separately, without mixing them up.
When you want to find the rank of students within each class.
When calculating running totals for each department in a company.
When comparing sales figures month by month for each product category.
When you need to find the average salary per job title in a company.