Ravindra BagaleCourses & study guides Track your progress

4. SQL for Data Engineers (Joins, Window Functions)

4.3 Window Functions Lite

Why. Running month totals per store need windows, not only GROUP BY.

SELECT store_city, order_date, amount_inr,
 SUM(amount_inr) OVER (PARTITION BY store_city ORDER BY order_date) AS running_inr
FROM fact_orders_fictional;

What. Window functions compute across related rows without collapsing them.