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.
[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]
[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]
[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 5.7
[/table]
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)
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.
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)
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.
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…