Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dates
8. Dates with BETWEEN
Time
Timestamps
Extract functions
Timezone conversion
Current date and time
Review

Instruction

That's it. Of course, you can also use dates with BETWEEN. In this way, you can for instance find production dates in a specific year:

SELECT
  id,
  model,
  produced
FROM aircraft
WHERE produced BETWEEN '2010-01-01' AND '2010-12-31';

The above query will find all the aircraft produced between January 1, 2010 and December 31, 2010, including these dates.

Exercise

Select the id and date of all flights which did NOT take place in 2015.

Stuck? Here's a hint!

Remember the proper date format and use apostrophes: 'YYYY-MM-DD'. Use NOT BETWEEN.