PostgreSQL window function for sum per interval
The table is represented by following scripts: CREATE TABLE sales ( id SERIAL PRIMARY KEY, product_id INTEGER, sales_date DATE, quantity INTEGER, price NUMERIC ); INSERT INTO sales (product_id, sales_date, quantity, price) VALUES (1, '2023-01-01', 10, 10.00), (1, '2023-01-02', 12, 12.00),…