Sort Results

It is possible to sort the output of a search using ORDER BY and stating the field, or fields. Fields are sorted ascending, smallest to largest, by default.

SELECT *
    FROM Pet
    ORDER BY species ASC;

To change the sort order of a field to descending the keyword DESC used. The keyword ASC is not needed but can be used to explicitly sort ascending. More than one field can be sorted.

SELECT *
    FROM Pet
    ORDER BY species DESC, 
             name ASC;