Temporal Statements | Temporal Table Support | Teradata Vantage - 17.10 - Temporal Statements - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Temporal Table Support

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

Using the period data type and the temporal column attributes in a CREATE TABLE statement, the application for the insurance company can create the Policy table as a temporal table with a valid-time column to record when rows are valid.

CREATE MULTISET TABLE Policy(
   Policy_ID INTEGER,
   Customer_ID INTEGER,
   Policy_Type CHAR(2) NOT NULL,
   Policy_Details CHAR(40),
   Validity PERIOD(DATE) NOT NULL AS VALIDTIME
   )
PRIMARY INDEX(Policy_ID);

The application can easily add a row to the table.

INSERT INTO Policy
   (Policy_ID, Customer_ID, Policy_Type, Policy_Details, Validity)
   VALUES (541008, 246824626, 'AU', 'STD-CH-345-NXY-00',
           PERIOD(DATE '2009-10-01', UNTIL_CHANGED));

Similarly, the application can easily query the table. The result of the following query is the rows that are valid at the current time (where the value of the Validity column overlaps with the current time):

CURRENT VALIDTIME SELECT * FROM Policy;