Sorting the data with ORDER BY

Previously, the order of the records was not fixed, i.e. the data came in a seemingly random order. Especially with large amounts of data, this makes the result much easier to grasp. We can change this by adding an ORDER BY clause at the end of a SELECT query:

SELECT <Feldliste>
  FROM <Tabelle>
 WHERE <Prädikat>
 ORDER BY <Sortierliste>

In the sort list we specify how to sort. For each column in the list, you can specify whether it should be sorted in ascending order(ASC, default value) or descending order(DESC). Example:

SELECT * 
  FROM tasks
 ORDER BY assignee ASC,
          due_date DESC