MySQL SOUNDS LIKE Function

MySQL SOUNDS LIKE is one of the String functions, which is useful to compare the Soundex codes of a given two string expressions. The basic syntax of the SOUNDS LIKE Function is as shown below:

SELECT 'String_Expression1' SOUNDS LIKE 'String_Expression2'

This is same as the SOUNDEX(‘String_Expression1’) = SOUNDEX(‘String_Expression2’). I suggest you refer to the SOUNDEX function article in MySQL.

MySQL SOUNDS LIKE Function Example

The Sounds Like Function compares the Soundex code of two string values and returns the output. The following query shows multiple ways to use this Sounds Like function.

SELECT 'Hi' SOUNDS LIKE 'Hi';

SELECT 'Hi' SOUNDS LIKE 'Hello';

SELECT 'MySQL' SOUNDS LIKE 'MySQ';
MySQL SOUNDS LIKE Function Example 1

Let me show you another example for a better understanding. The first two statements show the comparison between the two and return the same. Within the last statement, we used a NULL value. Remember, this String method returns NULL for NULL argument value.

SELECT 'Hi' SOUNDS LIKE 'Hi', SOUNDEX('Hi') = SOUNDEX('Hi');

SELECT 'Hello' SOUNDS LIKE 'Hi', SOUNDEX('Hello') = SOUNDEX('Hi');

SELECT NULL SOUNDS LIKE NULL, SOUNDEX(NULL) = SOUNDEX(NULL);
MySQL SOUNDS LIKE Function Example 2