Skip to content

SOUNDEX

  • str: This parameter is the string for which the SOUNDEX value will be calculated. SOUNDEX is a phonetic algorithm for indexing names by sound, as pronounced in English, which is useful in situations where you want to find ‘sound-alike’ names in a database. The SOUNDEX(str) function returns a string 4 characters long, starting with a letter.
SELECT SOUNDEX('MySQL') as Soundex_Code;
+--------------+
| Soundex_Code |
+--------------+
| M240 |
+--------------+

In this example, the SOUNDEX() function is used on the string ‘MySQL’. The SOUNDEX() function returns a phonetic representation of ‘MySQL’ as ‘M240’. Thus, this function can be used for phonetic comparisons in MySQL.