OVERLAPS Example 6 - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Assume the following query runs on the employee table where period1 and period2 are PERIOD(DATE) columns:

SELECT * FROM employee WHERE period2 OVERLAPS period1; 
Ename period1 period2
Adams ('2005-02-03', '2006-02-03') ('2005-02-03', '2006-02-03')
Mary ('2005-04-02', '2006-01-03') ('2005-02-03', '2006-02-03')
Jones ('2004-01-02', '2004-03-05') ('2004-03-05', '2004-10-07')
Randy ('2004-01-02', '2004-03-05') ('2004-03-07', '2004-10-07')
Simon ? ('2005-02-03', '2005-07-27')

The result is:

Ename period1 period2
Adams ('2005-02-03', '2006-02-03') ('2005-02-03', '2006-02-03')
Mary ('2005-04-02', '2006-01-03') ('2005-02-03', '2006-02-03')