Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

STRCMP

Example

Assess the similarity between two strings.

SELECT STRCMP(“SQL Tutorial”, “SQL Tutorial”); 

Definition and Usage

The STRCMP() function evaluates the relationship between two strings.

Syntax

STRCMP(string1, string2)

Parameter Values

Parameter

Description

string1, string2

Necessary. The pair of strings for comparison.

Return Values

  • If string1 = string2, this function yields 0
  • If string1 < string2, this function yields -1
  • If string1 > string2, this function yields 1

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Assess the relationship between two strings.

SELECT STRCMP(“SQL Tutorial”, “HTML Tutorial”);