If I just get the records from my user table they appear in the order they are stored
SELECT user_id
, firstname
, lastname
, username
, dob
FROM user;
+---------+-----------+----------+----------+------------+
| user_id | firstname | lastname | username | dob |
+---------+-----------+----------+----------+------------+
| 1 | Peter | Dowt | peterd | 2009-12-21 |
| 2 | Laura | Norder | lauran | 2010-10-22 |
| 3 | Tom | DiCanari | tomd | 2007-10-24 |
| 4 | Scott | Chegg | cheggs | 2008-03-08 |
| 5 | Polly | Vinyl | pollyv | 2010-12-15 |
| 6 | Polly | Styrene | pollys | 2005-08-20 |
| 7 | Tom | Catt | tomc | 2011-02-17 |
+---------+-----------+----------+----------+------------+
However, I want to list then in order of their dates of birth (dob column) so add an order by clause to the query
SELECT user_id
, firstname
, lastname
, username
, dob
FROM user
ORDER BY dob;
+---------+-----------+----------+----------+------------+
| user_id | firstname | lastname | username | dob |
+---------+-----------+----------+----------+------------+
| 6 | Polly | Styrene | pollys | 2005-08-20 |
| 3 | Tom | DiCanari | tomd | 2007-10-24 |
| 4 | Scott | Chegg | cheggs | 2008-03-08 |
| 1 | Peter | Dowt | peterd | 2009-12-21 |
| 2 | Laura | Norder | lauran | 2010-10-22 |
| 5 | Polly | Vinyl | pollyv | 2010-12-15 |
| 7 | Tom | Catt | tomc | 2011-02-17 |
+---------+-----------+----------+----------+------------+