SQLite ORDER BY clause

The SQLite ORDER BY clause is used to arrange and sort data and can be used in combination with the SQLite SELECT statement.

An example:

SELECT
   clientname
FROM
   customers
ORDER BY
    sales ASC,
    complaints DESC;

This will return all client names from the customers table, in ascending order by the sales generated to the respective client as well, if sales is identical, the descending order based on the amount of complaints made by the respective client.