Example Query - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

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;