MySQL SOUNDS LIKE is one of the String Function, which is used to compare the soundex codes of a given two string expressions. In this article, we will show you, How to use this string SOUNDS LIKE in MySQL with example.
MySQL SOUNDS LIKE Syntax
The basic syntax of the SOUNDS LIKE Function in MySQL 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 to refer to SOUNDEX function article.
MySQL SOUNDS LIKE Function Example
The Sounds Like Function compares the soundex code of two string value, 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';
Let me show you another example of SOUNDS LIKE for better understanding. First two statements are showing that the SOUNDS LIKE and SOUNDEX comparison returns same. Within the last statement, we used NULL value. Remember, SOUNDS LIKE function 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);
Thank You for Visiting Our Blog