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

MySQLMySQLi Database

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.

raja
Updated on 20-Jun-2020 11:04:34

Advertisements