Best April deals - 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

Good job! Interval arithmetic is often used with intervals when we want to find facts for a specific month. We no longer need to check whether a given month has 28, 29 (February), 30 or 31 days; the database will do that for us.

SELECT id
FROM aircraft
WHERE produced_date >= '2010-01-01'
  AND produced_date <  '2010-01-01'::date + INTERVAL '1 month';

Check it out for yourself!

Exercise

Count the number of flights performed within 180 days from the beginning of August 2015. Name the column flights.