Sorting ENUM Values
mysql>
mysql> CREATE TABLE weekday
-> (
-> day ENUM('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
-> );
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> INSERT INTO weekday (day) VALUES('Monday'),('Friday'), ('Tuesday'), ('Sunday'), ('Thursday'), ('Saturday'), ('Wed
nesday');
Query OK, 7 rows affected (0.00 sec)
Records: 7 Duplicates: 0 Warnings: 0
mysql>
mysql> SELECT day, day+0 FROM weekday;
+-----------+-------+
| day | day+0 |
+-----------+-------+
| Monday | 2 |
| Friday | 6 |
| Tuesday | 3 |
| Sunday | 1 |
| Thursday | 5 |
| Saturday | 7 |
| Wednesday | 4 |
+-----------+-------+
7 rows in set (0.00 sec)
mysql>
mysql> drop table weekday;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category