The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Check if a Date Range Overlaps another Date Range

Jim Knicely authored this tip.

The OVERLAPS Vertica built-in function evaluates two time periods and returns true when they overlap, false otherwise.

Example:

dbadmin=> SELECT (DATE '2018-04-18', DATE '2018-04-21') OVERLAPS (DATE '2018-04-16', DATE '2018-04-19');
 overlaps
----------
t
(1 row)

dbadmin=> SELECT (DATE '2018-04-18', DATE '2018-04-21') OVERLAPS (DATE '2018-04-22', DATE '2018-04-25');
 overlaps
----------
f
(1 row)

Have Fun!

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.