Example: Expansion on an Anchor Point Using ANCHOR_SECOND - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Create a table named t2 with the following definition.

     CREATE TABLE t2 (
       id       INTEGER
       quantity INTEGER
       pd       PERIOD(DATE))
       PRIMARY INDEX (id);

The input row for the example statement is of type TIMESTAMP and contains the following timestamp period data. (2011-01-01 10:15:20.000001, 2011-01-01 10:15:25.000009).

Submit the following SELECT statement on table t2.

     SELECT BEGIN(expd)
     FROM t2
     EXPAND ON pd AS expd BY ANCHOR ANCHOR_SECOND;

The result set contains 5 rows because the input row has a period of 5 seconds, beginning with 10:15:20.000001 and ending with 10:15:25.000009.

begin expd
--------------------------
2011-01-01 10:15:21.000000
2011-01-01 10:15:22.000000
2011-01-01 10:15:23.000000
2011-01-01 10:15:24.000000
2011-01-01 10:15:25.000000