Introduction
Dealing with dates
Working with time data
13. Using BETWEEN with time
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 BETWEEN with time data:

SELECT
  Code,
  DepartureTime
FROM Route
WHERE ArrivalTime BETWEEN '12:00:00'
  AND '15:00:00';

Remember that BETWEEN is inclusive—in the above query, routes that depart at 12 AM or 3 PM will be included in the results.

Exercise

Show the codes for all routes departing between 11 AM and 5 PM.

Stuck? Here's a hint!

Remember about the proper time format and use quotes: 'hh:mm:ss'. Note that 5:00 PM is '17:00:00' in T-SQL.