To make a string comparison not case sensitive, convert both strings to the same lettercase using UPPER( ) or
LOWER( ):
mysql>
mysql> SELECT UPPER('A'), UPPER('b'), UPPER('A') < UPPER('b');
+------------+------------+-------------------------+
| UPPER('A') | UPPER('b') | UPPER('A') < UPPER('b') |
+------------+------------+-------------------------+
| A | B | 1 |
+------------+------------+-------------------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql> SELECT LOWER('A'), LOWER('b'), LOWER('A') < LOWER('b');
+------------+------------+-------------------------+
| LOWER('A') | LOWER('b') | LOWER('A') < LOWER('b') |
+------------+------------+-------------------------+
| a | b | 1 |
+------------+------------+-------------------------+
1 row in set (0.00 sec)
mysql>
Related examples in the same category