STRCMP (str1, STR2)
Compares two strings if the two strings are equal to return 0 if the first argument is less than the second parameter in order of the current sort to return-1, otherwise returns 1.
mysql> SELECT STRCMP (' MOHD ', ' MOHD '); +---------------------------------------------------------+| STRCMP (' MOHD ', ' MOHD ') |+---------------------------------------------------------+| 0 |+--------------- ------------------------------------------+1 Row in Set (0.00 sec)
Another example is:
mysql> SELECT STRCMP (' Amohd ', ' MOHD '); +---------------------------------------------------------+| STRCMP (' Amohd ', ' MOHD ') |+---------------------------------------------------------+|-1 |+------------- --------------------------------------------+1 Row in Set (0.00 sec)
Let's take a look at an example:
mysql> SELECT STRCMP (' MOHD ', ' Amohd '); +---------------------------------------------------------+| STRCMP (' MOHD ', ' Amohd ') |+---------------------------------------------------------+| 1 |+-------------- -------------------------------------------+1 Row in Set (0.00 sec)
MySQL strcmp function