This tutorial explains how to use the MySQL STRCMP function with syntax and examples.
The MySQL STRCMP function tests whether two strings are the same using the current character set.
The syntax for the STRCMP function in MySQL is:
STRCMP( string1, string2 )
The two strings to be compared to each other.
The STRCMP function can be used in the following versions of MySQL:
Let's look at some MySQL STRCMP function examples and explore how to use the STRCMP function in MySQL.
For example:
mysql> SELECT STRCMP('AODBA.com', 'AODBA.com');
Output: 0
mysql> SELECT STRCMP('mysite.com', 'AODBA.com');
Output: -1
mysql> SELECT STRCMP('AODBA.com', 'mysite.com');
Output: 1