The SQL OVERLAPS
operator returns true when two time periods overlap, false when they do not overlap..
Syntax
( start, end ) OVERLAPS ( start, end )
( start, length ) OVERLAPS ( start, length )
Semantics
start |
a DATE, TIME, or TIME STAMP value that specifies the beginning of a time period. |
end |
a DATE, TIME, or TIME STAMP value that specifies the end of a time period. |
interval |
an INTERVAL value that specifies the length of the time period. |
Examples
SELECT (DATE '2001-02-16', DATE '2001-12-21')
OVERLAPS (DATE '2001-10-30', DATE '2002-10-30');
Result: true
SELECT (DATE '2001-02-16', INTERVAL '100 days')
OVERLAPS (DATE '2001-10-30', DATE '2002-10-30');
Result: false