Example: Dropping a Valid-Time Column - Advanced SQL Engine - Teradata Database

Temporal Table Support

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
cjo1556732840654.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1182
lifecycle
previous
Product Category
Teradata Vantage™

To drop a valid-time column from a valid-time table, use the ALTER TABLE statement.

Consider the following valid-time table:

   CREATE MULTISET TABLE Customer (
      Customer_Name VARCHAR(40),
      Customer_ID INTEGER,
      Customer_Address VARCHAR(80),
      Customer_Phone VARCHAR(12),
      Customer_Validity PERIOD(DATE) NOT NULL AS VALIDTIME
      )
   PRIMARY INDEX ( Customer_ID );

The following statement drops the Customer_Validity column:

   ALTER TABLE Customer DROP Customer_Validity;

To drop a valid-time column from a bitemporal table, use the ALTER TABLE statement and specify the NONTEMPORAL qualifier. Dropping any type of column from a bitemporal table requires the NONTEMPORAL privilege on the table, and the NONTEMPORAL qualifier to ALTER TABLE must be used.

Consider the following bitemporal table:

   CREATE MULTISET TABLE Customer (
      Customer_Name VARCHAR(40),
      Customer_ID INTEGER,
      Customer_Address VARCHAR(80),
      Customer_Phone VARCHAR(12),
      Customer_Validity PERIOD(DATE) NOT NULL AS VALIDTIME,
      Customer_Duration PERIOD(TIMESTAMP(6) WITH TIME ZONE) NOT NULL
         AS TRANSACTIONTIME
      )
   PRIMARY INDEX ( Customer_ID );

The following statement drops the Customer_Validity column:

   NONTEMPORAL ALTER TABLE Customer DROP Customer_Validity;

When a valid-time column is dropped from a bitemporal table, all rows that are no longer valid (all history rows in the valid-time dimension) are physically deleted from the table.