Example: Adding a Derived Period Column to a Table - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

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

This example modifies a table to add a derived period column.

Here is the table definition for this example.

CREATE TABLE employee (
eid INTEGER NOT NULL,
name VARCHAR(100) NOT NULL,
deptno INTEGER NOT NULL,
jobstart DATE NOT NULL,
jobend DATE NOT NULL
) PRIMARY INDEX(eid);

This following statement modifies the table, employee, to add a derived period column, jobduration, with jobstart as the period start column and jobend as the period end column.

ALTER TABLE employee ADD PERIOD FOR jobduration(jobstart, jobend);