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

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 AM or 3 PM sharp will be included in the results.

Exercise

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

Stuck? Here's a hint!

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

Console

Code editor

Result

TableConsole