17.10 - Example: UPDATE on an ANSI Valid-Time Table Where the PA of Update Overlaps a Portion of the PV of the Row - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - ANSI Temporal Table Support

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

Temporal tables allow you to modify rows for only a portion of their period of validity. The database takes care of adding rows and adjusting valid-time periods to account for the change automatically. The database automatically handles the valid-time modifications for the row, which may involve changing the period bounds and adding new rows to the table.

For example, assume the company promotes Alice from employment terms TW10 to PW11 after she has been working for a year. Modifying the Alice row for only that portion of the row period of validity automatically yields two rows for Alice in the table:

UPDATE employee_vt
FOR PORTION OF job_dur FROM DATE'2005-12-01' TO DATE'9999-12-31'
SET terms='PW11'
WHERE ename='Alice';

SELECT * FROM employee_vt WHERE ename=’Alice’;

eid ename terms    job_start     job_end
---- ----- ----- ----------- -----------
1005 Alice PW11   2005/12/01  9999/12/01
1005 Alice TW10   2004/12/01  2005/12/01

Now the table has two rows for Alice that show how the terms of her employment changed, and the temporal extent of when she worked under each of the terms.