Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
9. Dates with ORDER BY
Working with time
Date and time data types in PostgreSQL
Extracting dates and times
Timezone conversion
Format date and time
Current date and time data
Summary

Instruction

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

SELECT
  id,
  model,
  produced_date
FROM aircraft
WHERE produced_date BETWEEN '2009-01-01'
AND '2010-12-31'
ORDER BY produced_date;

As usual, you can define the sort order by adding ASC (the default sort order) or DESC at the end of the ORDER BY clause.

Exercise

Show the ID and date of all flights in 2015, so the most recent flights are first.

Stuck? Here's a hint!

Listing the newest dates first means you need descending order.