Reference Guide > TDV Support for SQL Operators > Condition Operators > OVERLAPS
 
OVERLAPS
The OVERLAPS operator returns TRUE when two time periods (defined by their endpoints) overlap, FALSE when they do not overlap.
Syntax
(start1, end1) OVERLAPS (start2, end2)
(start1, length1) OVERLAPS (start2, length2)
Remarks
The endpoints can be specified as pairs of dates, times, or time stamps; or as a date, time, or time stamp followed by an interval.
When a pair of values is provided, either the start or the end can be written first. OVERLAPS automatically takes the earlier value of the pair as the start.
Each time period is considered to represent the half-open interval start <= time < end, unless start and end are equal, in which case it represents that single time instant. This means, for instance, that two time periods with only an endpoint in common do not overlap.
Examples
SELECT (DATE '2016-04-16', DATE '2016-11-25') OVERLAPS
(DATE '2016-11-28', DATE '2017-11-28');
The result is TRUE.
SELECT (DATE '2016-02-16', INTERVAL '120 days') OVERLAPS
(DATE '2016-11-28', DATE '2017-11-28');
The result is FALSE.
SELECT (DATE '2016-09-29', DATE '2016-11-28') OVERLAPS
(DATE '2016-11-28', DATE '2016-11-29');
The result is FALSE.
SELECT (DATE '2016-05-05', DATE '2016-05-05') OVERLAPS
(DATE '2016-05-05', DATE '2016-05-05');
The result is TRUE.