Introduction
Dealing with dates
8. Using BETWEEN with dates
Working with time data
Date and time date
Extracting dates and times
Doing arithmetic with dates
Converting date and time data
Current date and time data
Building date and time data from parts
Summary and review

Instruction

You can also use dates with BETWEEN. In this way, you can select dates within a range (e.g. production dates for the year 2010):

SELECT
  Id,
  Model,
  ProducedDate
FROM Aircraft
WHERE ProducedDate BETWEEN '2010-01-01'
  AND '2010-12-31';

This will find all the aircraft produced between January 1, 2010 and December 31, 2010, including the start and end dates.

Exercise

Select the Id and Date of all flights that did not take place in 2015.

Stuck? Here's a hint!

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