What do PARTITION BY and ORDER BY do inside OVER?
Model answer
PARTITION BY splits rows into groups that the function works on separately, like GROUP BY but without collapsing. ORDER BY defines the order inside each partition, which matters for ranking and running totals.
Learn this topic
Window Functions: ROW_NUMBER, RANK and Running Totals in the course SQL for Beginners: Learn Databases Step by Step.
Sign in to add your own answer.