What is the proper structure for searching within MySQL using SOUNDEX()?


Basically, SOUNDEX() function is used to return the Soundex, a phonetic algorithm for indexing names after English pronunciation of sound, a string of a string. The proper structure for searching within MySQL using SOUNDEX() is as follows −

SOUNDEX(Str)

Here, Str is the string whose SOUNDEX string is to be retrieved.

Example

mysql> Select SOUNDEX('MySQL');
+------------------+
| SOUNDEX('MySQL') |
+------------------+
| M240             |
+------------------+
1 row in set (0.00 sec)

mysql> Select SOUNDEX('harshit');
+--------------------+
| SOUNDEX('harshit') |
+--------------------+
| H623               |
+--------------------+
1 row in set (0.00 sec)

mysql> Select SOUNDEX('hrst');
+-----------------+
| SOUNDEX('hrst') |
+-----------------+
| H623            |
+-----------------+
1 row in set (0.00 sec)

The result of SOUNDEX(‘harshit’) and SOUNDEX(‘hrst’) is same because the sound of both the words is same.

Updated on: 20-Jun-2020

84 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements