The queries in this example reference the following table definition and data:
CREATE TABLE t (id INTEGER, v INTEGER); INSERT INTO t VALUES (1,1); INSERT INTO t VALUES (1,2); INSERT INTO t VALUES (1,3); INSERT INTO t VALUES (1,4); INSERT INTO t VALUES (1,5); INSERT INTO t VALUES (1,6); INSERT INTO t VALUES (1,7); INSERT INTO t VALUES (1,8); SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v) FROM t; SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v ROWS UNBOUNDED PRECEDING) FROM t; SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) FROM t; SELECT id, v, MYSUM(v) OVER() FROM t;