17.10 - Table and Data Definition for MERGE Examples - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1208-171K
Language
English (United States)

Following are the definitions of the tables used in the examples.

Here is the table definition for the sequenced PTI table src_s, which includes a time zero specification of October 15, 2016, DATE '2016-10-15', and time bucket duration of 1 hour, HOURS(1).

CREATE TABLE src_s(
      TD_TIMEBUCKET BIGINT NOT NULL GENERATED SYSTEM TIMECOLUMN,
      TD_TIMECODE TIMESTAMP(1) NOT NULL GENERATED TIMECOLUMN,
      TD_SEQNO INT NOT NULL GENERATED TIMECOLUMN,
      c1 INTEGER,
      c2 INTEGER)
 PRIMARY TIME INDEX (TIMESTAMP(1), DATE '2016-10-15', HOURS(1), COLUMNS(C1), SEQUENCED(500));

Below is the table definition for the sequenced PTI table tgt_s, which includes a time zero specification of October 15, 2016, DATE '2016-10-15', and time bucket duration of 1 hour, HOURS(1).

CREATE TABLE tgt_s(
      TD_TIMEBUCKET BIGINT NOT NULL GENERATED SYSTEM TIMECOLUMN,
      TD_TIMECODE TIMESTAMP(1) NOT NULL GENERATED TIMECOLUMN,
      TD_SEQNO INT NOT NULL GENERATED TIMECOLUMN,
      c1 INTEGER,
      c2 INTEGER)
 PRIMARY TIME INDEX (TIMESTAMP(1), DATE '2016-10-15', HOURS(1), COLUMNS(C1), SEQUENCED(500));

Here is the table definition for the sequenced PTI table tgt_s2, which includes a time zero specification of October 15, 2016, DATE '2016-10-15', and time bucket duration of 2 hours, HOURS(2).

CREATE TABLE tgt_s2(
      TD_TIMEBUCKET BIGINT NOT NULL GENERATED SYSTEM TIMECOLUMN,
      TD_TIMECODE TIMESTAMP(1) NOT NULL GENERATED TIMECOLUMN,
      TD_SEQNO INT NOT NULL GENERATED TIMECOLUMN,
      c1 INTEGER,
      c2 INTEGER)
 PRIMARY TIME INDEX (TIMESTAMP(1), DATE '2016-10-15', HOURS(2), COLUMNS(C1), SEQUENCED(500));