Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time
Date and time data types in PostgreSQL
Extracting dates and times
Intervals
Timezone conversion
Format date and time
Current date and time data
Summary

Instruction

Great! PostgreSQL has also another useful operator – OVERLAPS:

(start1, end1) OVERLAPS
(start2, end2)

As you may guess, it yields true when the two time periods (defined by their endpoints) overlap, and false when they don't.

The OVERLAPS operator works great with intervals too:

(start1, interval) OVERLAPS
(start2, interval)

Exercise

Let's see what aircraft were used while the Boeing 777-300 (ID of 8) was flying. In this exercise, just run the template query.

Note that you won't see aircraft that are still in use (those of NULL value in the withdrawn_timestamp column). We will learn how to show them in the next part of the course.