String Functions MySQL Tutorial

STRCMP() returns 0 if the strings are the same.
STRCMP() returns -1 if the first argument is smaller than the second according to the current sort order.
STRCMP() returns 1 otherwise.

mysql> SELECT STRCMP('text', 'text2');
+-------------------------+
| STRCMP('text', 'text2') |
+-------------------------+
|                      -1 |
+-------------------------+
1 row in set (0.00 sec)
mysql> SELECT STRCMP('text2', 'text');
+-------------------------+
| STRCMP('text2', 'text') |
+-------------------------+
|                       1 |
+-------------------------+
1 row in set (0.00 sec)
mysql> SELECT STRCMP('text', 'text');
+------------------------+
| STRCMP('text', 'text') |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)