17.00 - 17.05 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
17.05
Release Date
June 2020
Content Type
Programming Reference
Publication ID
B035-1211-170K
Language
English (United States)

If we assume that the employee table, created by the following SQL statement:

CREATE MULTISET TABLE employee(empno    INTEGER,
                               ename    VARCHAR(50),
                               deptno   INTEGER,
                               jobstart DATE NOT NULL,
                               jobend   DATE NOT NULL,
                               PERIOD FOR jobduration(jobstart, jobend))
                               PRIMARY INDEX(empno);

contains the following row:

INSERT INTO employee(1025, 'John', '999', DATE'2005-02-03', UNTIL_CHANGED);

The following SELECT statement:

SELECT empno,ename(CHAR(30)) FROM employee WHERE END(jobduration) IS UNTIL_CHANGED;

returns:

empno ename
------ ------
  1025   John