Javatpoint Logo
Javatpoint Logo

MySQL STRCMP() Function

The strcmp() is a String function of MySQL. This function compares the given two strings. This function returns 0 if both the strings are same, -1 if the first string is smaller than second else it returns 1.

Syntax

Parameters:

Str1 and str2: two strings to be compared

Returns:

  • If both the strings are same, this function will return 0.
  • If str1 is smaller than str2, this function will return -1.
  • If str1 is larger than str2, this function will return 1.

Example 1

Output:


MySQL String STRCMP() Function

Example 2

Output:


MySQL String STRCMP() Function

Example 3

Output:


MySQL String STRCMP() Function
Next TopicMySQL String





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA