Vertica Quick Tip: Check if a Date Range Overlaps another Date Range

Posted April 19, 2018 by Soniya Shah, Information Developer

This blog post was authored by Jim Knicely. 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!