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


Nice job! You can also sort your rows by date using ORDER BY:

FROM Aircraft
WHERE ProducedDate BETWEEN '2009-01-01' AND '2010-12-31'
ORDER BY ProducedDate;

As usual, you can add ASC (the default sort order) or DESC after the ORDER BY clause to define the sort order.


Select the Id and Date of all flights in 2015 and sort them, putting the most recent first.

Stuck? Here's a hint!

Remember about the proper date format and use quotes: 'YYYY-MM-DD'. Sorting recent dates first means DESCending order.