This query illustrates the default window frame for RANGE:
SELECT prod_id, month_num, sales, SUM(sales) OVER (PARTITION BY prod_id ORDER BY month_num) FROM sale ORDER BY prod_id, month_num;
The results from the above query:
prod_id month_num sales max(sales) ------- --------- ----- ---------- 10 1 100 250 10 1 150 250 10 2 120 370 10 3 100 470 10 4 130 600 10 5 120 751 10 5 31 751 10 6 110 861 20 1 20 20 20 2 30 50 20 3 25 75 20 4 30 105 20 5 31 136 20 6 20 156 30 1 10 10 30 2 11 21 30 3 12 33 30 4 1 35 30 4 1 35
The query in this example is equivalent to:
SELECT prod_id, month_num, sales, SUM(sales) OVER (PARTITION BY prod_id ORDER BY month_num RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM sale ORDER BY prod_id, month_num;