Categories: MySQL FunctionsPHP

MySQL8 SOUNDS LIKE() Functions – String Functions

SOUNDS LIKE() Functions returns value 0 (False)or 1(True) depending upon the sounds of the input strings matches or not.

This operator works best on strings in the English language (using it with other languages may return unreliable results).

Returns NULL if any of the argument is NULL.


MySQL SOUNDS LIKE Functions: Syntax

expression1 SOUNDS LIKE expression2;
Above syntax can also be rewitten as
SOUNDEX(expression1)  =  SOUNDEX(expression2)

MySQL SOUNDS LIKE Functions: Parameter

[table caption=”” width=”100%” colwidth=”15%|15%|15%|55%” colalign=”left|left|left|left”]
Name, Required /Optional,Type, Description
expression1 , Required, String , It represents valid string.
expression2, Required, String , It represents valid string.
[/table]


MySQL SOUNDS LIKE Functions: Output

[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Return, Description
NULL, if argument is NULL.
0, if the input strings don’t sound similar
1, if the input strings sound similar
[/table]


MySQL SOUNDS LIKE Functions: Available from

[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 5.7
[/table]


SOUNDS LIKE Example 1 : Very easy example

We have to pass our string in the input parameter and we will get the sound string value of the inputs. Below is the example to show if the sound of both the words is similar then it returns 1.

mysql> SELECT 'male' SOUNDS LIKE 'mail';
+---------------------------+
| 'male' SOUNDS LIKE 'mail' |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set (0.05 sec)

SOUNDS LIKE Example 2 : Some more examples

Below are some more examples.

Smysql> SELECT 'ball' SOUNDS LIKE 'bawl';
+---------------------------+
| 'ball' SOUNDS LIKE 'bawl' |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT 'made' SOUNDS LIKE 'maid';
+---------------------------+
| 'made' SOUNDS LIKE 'maid' |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT 'arc' SOUNDS LIKE 'ark';
+-------------------------+
| 'arc' SOUNDS LIKE 'ark' |
+-------------------------+
|                       1 |
+-------------------------+
1 row in set (0.00 sec)

Above example returns the 1 value as all input string sound is similar.


SOUNDS LIKE Example 3 : Compared to SOUNDEX function

Here it is compared to SOUNDEX(). See below example :

mysql> SELECT 'made' SOUNDS LIKE 'maid' AS 'SOUNDS LIKE', 
              SOUNDEX('made') = SOUNDEX('maid') AS 'SOUNDEX()';
+-------------+-----------+
| SOUNDS LIKE | SOUNDEX() |
+-------------+-----------+
|           1 |         1 |
+-------------+-----------+
1 row in set (0.25 sec)

SOUNDS LIKE Example 4 : NULL arguments

If any of the arguments is NULL, it will return NULL. See below example :

mysql> SELECT 'made' SOUNDS LIKE NULL;
+-------------------------+
| 'made' SOUNDS LIKE NULL |
+-------------------------+
|                    NULL |
+-------------------------+
1 row in set (0.06 sec)

mysql> SELECT NULL SOUNDS LIKE 'maid';
+-------------------------+
| NULL SOUNDS LIKE 'maid' |
+-------------------------+
|                    NULL |
+-------------------------+
1 row in set (0.00 sec)

See all MySQL String functions MySQL 8 String Functions.


Related articles : LOCATE(), HEX(), CONCAT(), CONCAT_WS() , LOWER(), LTRIM(), INSTR(), POSITION().


PHP Related articles : METAPHONE(), SOUNDEX(), PHP STRING FUNCTIONS(), SUBSTR_REPLACE().

jyoti rani

Recent Posts

What Is a Progressive Web App? Why Would You Need One?

App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…

11 months ago

7 Most Popular Paid Online Advertising Strategy

As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…

1 year ago

The Importance of User-Centered Design in Mobile App Development

Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…

1 year ago

Healthcare Mobile App Development: A Complete Guide for Founders

COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…

1 year ago

Exploring Diverse WordPress Theme Niches: A Comprehensive Guide

Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…

1 year ago

8 Awesome Blog Content Ideas for Movers to Skyrocket the SEO

For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…

1 year ago