Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time data
Date and time date
20. Sorting date and time data with ORDER BY
Extracting dates and times
Doing arithmetic with dates
Converting date and time data
Building date and time data from parts
Summary and review

Instruction

The last thing you should know about date and time data is that you can sort it with ORDER BY:

SELECT
  Id,
  LaunchedDatetime
FROM Aircraft
ORDER BY LaunchedDatetime;

Of course, you can use DESC or ASC after ORDER BY.

Exercise

Show the ID and launch date for all aircraft launched in 2013 and 2014. Sort by the LaunchedDatetime column, going from the newest to oldest dates.

Stuck? Here's a hint!

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