STRCMP( ) takes two string arguments and returns -1, 0, or 1, depending on whether the first string is lexical : STRCMP « String « SQL / MySQL






STRCMP( ) takes two string arguments and returns -1, 0, or 1, depending on whether the first string is lexical

      
ly less than, equal to, or greater than the second.
mysql>
mysql> SELECT STRCMP('Abc','abc'), STRCMP('abc','abc'), STRCMP('abc','Abc');
+---------------------+---------------------+---------------------+
| STRCMP('Abc','abc') | STRCMP('abc','abc') | STRCMP('abc','Abc') |
+---------------------+---------------------+---------------------+
|                   0 |                   0 |                   0 |
+---------------------+---------------------+---------------------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.The STRCMP() compares string values that can be literal values or derived from expressions