Creating a New Transaction-Time Table - Analytics Database - Teradata Vantage

Temporal Table Support

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-10-30
dita:mapPath
eud1628112402879.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
fif1472244754791
lifecycle
latest
Product Category
Teradata Vantage™

To create a transaction-time table, use a normal CREATE TABLE statement, and define one column of the table as a transaction-time column. The data type of the column can be derived from two TIMESTAMP(6) WITH TIME ZONE columns, or can be a single PERIOD(TIMESTAMP(6) WITH TIME ZONE) column, and must use the TRANSACTIONTIME or AS TRANSACTIONTIME column attribute. Transaction-time columns must also specify the NOT NULL column attribute.

Example: Creating a Derived Period Transaction-Time Table

   CREATE MULTISET TABLE Policy_Types (
      Policy_Name VARCHAR(20),
      Policy_Type CHAR(2) NOT NULL PRIMARY KEY,
      Policy_Start TIMESTAMP(6) WITH TIME ZONE NOT NULL,
      Policy_End TIMESTAMP(6) WITH TIME ZONE NOT NULL,
      PERIOD FOR Policy_Duration(Policy_Start,Policy_End)
         AS TRANSACTIONTIME
      )
   PRIMARY INDEX (Policy_Name);

Example: Creating a Period Data Type Transaction-Time Table

   CREATE MULTISET TABLE Policy_Types (
      Policy_Name VARCHAR(20),
      Policy_Type CHAR(2) NOT NULL PRIMARY KEY,
      Policy_Duration PERIOD(TIMESTAMP(6) WITH TIME ZONE) NOT NULL
         AS TRANSACTIONTIME
      )
   PRIMARY INDEX (Policy_Name);