Consider changing the column type to ENUM, if you always sort a non-enumeration column in a specific non-lexic
al order,
mysql>
mysql> CREATE TABLE color (name CHAR(10));
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO color (name) VALUES ('blue'),('green'),
-> ('indigo'),('orange'),('red'),('violet'),('yellow');
Query OK, 7 rows affected (0.00 sec)
Records: 7 Duplicates: 0 Warnings: 0
mysql>
mysql> SELECT name FROM color ORDER BY name;
+--------+
| name |
+--------+
| blue |
| green |
| indigo |
| orange |
| red |
| violet |
| yellow |
+--------+
7 rows in set (0.00 sec)
mysql>
mysql> drop table color;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category