For sorting in ascending order numbers which are written in text or characters:-
mysql> select number from (table) order by number;
+--------+
| number |
+--------+
| 1 |
| 10 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
+--------+
Use this:
mysql> select number from (tablename) order by (number+0);
+--------+
| number |
+--------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
+--------+
The (field + 0 ) converts the text/character in the field into an integer.
To sort results in a particular predefined order list. We can Just use the FIELD function:
SELECT * FROM task_list
ORDER BY FIELD(priority, 'High', 'Normal', 'Low', 'The Abyss');