Using WINDOW FRAME with ROWS BETWEEN for Custom Aggregations
WINDOW FRAME allows fine-grained control over the rows included in a calculation within a window function.
SELECT order_id, order_date, SUM(amount) OVER (ORDER BY order_date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) AS rolling_sum FROM orders;