What is a window function and how is it different from GROUP BY?
Model answer
A window function calculates over a set of related rows without collapsing them: SUM(amount) OVER (PARTITION BY customer_id). GROUP BY returns one row per group, while a window function keeps every row and adds the calculated value.
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.