The SOUNDEX function is used for checking whether two words are pronounced same irrespective of how they are spelled.
For example if a person is having "Smith" name. Some people spelled it as "Smith" and some people write it as "Smythe". However they are spelled they are pronounced same.
SOUNDEX ( character_expression )
Suppose we have a table column "LastName" and in this column there are various employees whose lastname is Smith but they have written it differently. To find out all those rows whose names are pronounced as Smith, you can use SOUNDEX function.
select * from employees where SOUNDEX(lastname)=SOUNDEX('smith');
SOUNDEX converts an alphanumeric string to a four-character code that is based on how the string sounds when spoken.
If you just give the following query it will show the four character code for string
SOUNDEX function is also available in MySQL. But it works only for English language and words of other languages are not supported as of MySQL version 5.1
Suppose in MySQL we have table by name 'Employees' with the following data
Now to see all the employees whose name sounds like 'Smith' you can use the SOUNDEX function like this
select * from employees where SOUNDEX(lastname)=SOUNDEX('smith')
In MySQL you instead of the above query you can also give the following query which will produce the same result
select * from employees where lastname SOUNDS LIKE 'smith'
i.e. instead of writing SOUNDEX(lastname)=SOUNDEX('smith') you can write the query in simple english lastname SOUNDS LIKE 'smith'