Introduction
Dates
8. Dates with BETWEEN
Time
Timestamps
Extract functions
Timezone conversion
Intervals
Current date and time
Revision

Instruction

That's it. Of course, you can also use dates with BETWEEN. In this way, you can e.g. 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 about the proper date format and use apostrophes: 'YYYY-MM-DD'. Use NOT BETWEEN.

Console

Code editor

Result

TableConsole