STRCMP

STRCMP is a SQL function used to compare two strings. It returns 0 if both strings are the same, -1 if the first string is smaller than the second, and 1 if the first string is greater than the second. The comparison is based on the ASCII value of characters.

Example

SELECT STRCMP("Hello", "World");

Output

-1

Explanation

In this example, the STRCMP() function compares two strings “Hello” and “World”. The result is -1 because “Hello” is less than “World” based on the ASCII value.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.