String comparisons are performed from left to right, one character at a time: : String Compare « String « SQL / MySQL






String comparisons are performed from left to right, one character at a time:

      
mysql>
mysql> SELECT 'abc' < 'b';
+-------------+
| 'abc' < 'b' |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT 'bbc' <= 'b';
+--------------+
| 'bbc' <= 'b' |
+--------------+
|            0 |
+--------------+
1 row in set (0.00 sec)

   
    
    
    
    
    
  








Related examples in the same category

1.Compare String in where clause
2.The two strings '4200' and '4200.0' are not the same:
3.Case-insensitive nature of string comparisons:
4.String comparisons in MySQL are not case sensitive by default:
5.To make a string comparison case sensitive, cast (convert) one of the strings to binary form by using the BINA
6.To make a string comparison not case sensitive, convert both strings to the same lettercase using UPPER( ) or
7.NULL values fail comparisons both with < and with >=