SQL - Window Functions Fundamentals
Given the table
Assuming data:
sales(date, amount) ordered by date, what is the output of this query?SELECT date, amount, SUM(amount) OVER (ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS running_sum FROM sales;
Assuming data:
date | amount
2024-01-01 | 100
2024-01-02 | 200
2024-01-03 | 300