TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

MySQL

MySQL STRCMP Function

Overview

In this tutorial, we will learn about MySQL STRCMP function with an example. STRCMP() function is a string comparison function. We can use this function to compare strings.

The STRCMP() function returns 0 as result if the strings are the same, -1 if the first argument is smaller than the second argument according to the sort order, and 1 otherwise.

Syntax

The general syntax of the function is as follows:

STRCMP(strarg1,strarg2)

Examples

mysql> SELECT STRCMP(‘Testing’,’Testing’);
+—————————–+
| STRCMP(‘Testing’,’Testing’) |
+—————————–+
| 0 |
+—————————–+
1 row in set (0.02 sec)

mysql> SELECT STRCMP(‘Testing’,’testing’);
+—————————–+
| STRCMP(‘Testing’,’testing’) |
+—————————–+
| 0 |
+—————————–+
1 row in set (0.00 sec)

mysql> SELECT STRCMP(‘Testing’,’Testing2′);
+——————————+
| STRCMP(‘Testing’,’Testing2′) |
+——————————+
| -1 |
+——————————+
1 row in set (0.00 sec)

mysql> SELECT STRCMP(‘Testing2′,’Testing’);
+——————————+
| STRCMP(‘Testing2′,’Testing’) |
+——————————+
| 1 |
+——————————+
1 row in set (0.00 sec)

MySQL STRCMP Function

—

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Related Posts

DataGrip Desktop Shortcut

MySQL /

Launch DataGrip on Windows

DataGrip Download

MySQL /

Install DataGrip IDE on Windows 11

MySQL Workbench Windows 11

MySQL /

New MySQL Connection in Workbench

MySQL Command-line Client

MySQL /

Command-Line MySQL Client

Start MySQL Client

MySQL /

Start MySQL Client on Windows 11

‹ MySQL DESCRIBE Statement› MySQL LEFT Function

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com