Introduction
Dealing with dates
Working with time data
14. Sorting by TIME columns
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

Good! You can also sort by time:

SELECT
  Code,
  DepartureTime
FROM Route
ORDER BY ArrivalTime DESC;

Have you noticed that TIME and DATE data work very similarly?

Exercise

Show the Code and ArrivalTime of all routes that arrive before 4 PM. Order them by arrival time, with the earliest time first.

Stuck? Here's a hint!

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