MySQL SOUNDEX Function

MySQL SOUNDEX is one of the String functions, which is to return the Soundex code of a given string. Generally, it returns the four digits’ standard code as an output. However, this is not the case for the long-string arguments.

As the name suggests, the SOUNDEX returns the code based on the string sound. I mean, if two strings sound identical, then the value will be identical too. The basic syntax of the MySQL SOUNDEX Function is as shown below:

SELECT SOUNDEX(String_Expression) FROM [Source]

MySQL SOUNDEX Function Example

It returns the Soundex code value of a user-specified string expression. The following query shows you multiple ways to use this function.

SELECT SOUNDEX('Hello');

SELECT SOUNDEX('MySQL');

SELECT SOUNDEX('Suresh');
SOUNDEX Example 1

Let me show you another MySQL example for better understanding. Within the last statement, we used a NULL value. Remember, this String method returns NULL for NULL argument value.

SELECT SOUNDEX('Hi');

SELECT SOUNDEX('Hello');

SELECT SOUNDEX(NULL);
MySQL SOUNDEX Function 2