Sorting

Sorting databases
Sorting a database arranges the records in order.

There are two questions which should be considered before performing any sort:
 * 1) Which fields will be sorted (i.e. what are the sort keys)?
 * 2) Will the order be ascending or descending?

A simple sort arranges the records based on the contents of one field in a database table

A complex sort involves the software arranging the records based on two or more fields. A complex sort will have a primary and secondary sort key. The data is first sorted by the primary sort key and then the secondary sort key is used if two or more fields have the same value.

Once the sort keys have been identified there are two ways of sorting data, namely [|ascending] and [|descending].

Now complete these practical exercise on sorting a database.