# Comparing String
__*STRCMP function*__
+ `STRCMP()`: Compares str1 and str2 
+ Return value: 
  + 0 indicates that str1 and str2 are the same 
  + -1 means str1 is less than str2 
  + 1 means str1 is greater than str2
+ `=`: Tests whether strings are equal
+ For example:
  + `SELECT strcmp('ABC','ABc'), strcmp('ABC','ABC'), strcmp('ABc','ABC');`  
  + `SELECT 'ABC' = 'ABC';`  
```
tidb> select strcmp('ABC','ABc'), strcmp('ABC','ABC'), strcmp('ABc','ABC');
+---------------------+---------------------+---------------------+
| strcmp('ABC','ABc') | strcmp('ABC','ABC') | strcmp('ABc','ABC') |
+---------------------+---------------------+---------------------+
| -1                  | 0                   | 1                   |
+---------------------+---------------------+---------------------+
1 row in set (0.00 sec)
```

------------------------------------------------------------
```
tidb> select strcmp('ABC','ABc'), strcmp('ABC','ABC'), strcmp('ABc','ABC');
+---------------------+---------------------+---------------------+
| strcmp('ABC','ABc') | strcmp('ABC','ABC') | strcmp('ABc','ABC') |
+---------------------+---------------------+---------------------+
| -1                  | 0                   | 1                   |
+---------------------+---------------------+---------------------+
1 row in set (0.00 sec)
tidb> select 'ABC' = 'ABC';
+---------------+
| 'ABC' = 'ABC' |
+---------------+
| 1             |
+---------------+
1 row in set (0.00 sec)
```


