Name
STRCMP( )
Synopsis
STRCMP(string
,string
)
This function compares two strings to determine whether the first string is before or after the second string in ASCII sequence. If the first string precedes the second, -1 is returned. If it follows the second, 1 is returned. If they are equal, 0 is returned. This function is often used for alphanumeric comparisons, but is case-sensitive.
SELECT STRCMP('test','text') AS Comparison; +------------+ | Comparison | +------------+ | -1 | +------------+
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.