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

Instruction

That's right. You can also use BETWEEN with time:

SELECT code, departure
FROM route
WHERE arrival BETWEEN '12:00:00'
  AND '15:00:00';

Just like with dates, remember that BETWEEN is inclusive – routes which depart at 12:00 Noon or 3:00 PM sharp will be included in the results.

Exercise

Show the code of all the routes which depart between 11:00 AM and 5:00 PM.

Stuck? Here's a hint!

Remember the proper time format and use apostrophes: 'HH:MM:SS'. 5:00 PM is '17:00:00' in SQL.