Suman Biswas
Suman Biswas

Reputation: 883

Mysql search results for similar sounds

Suppose I have a user table. One of a column of the table store for user first name. Also suppose there are there rows in the table. The user first names are as follows : 'Suman','Sumon','Papiya'. Now I want a mysql query if an user search from the table by user first name with 'Suman' then the result will shows two rows one for 'Suman' and another for 'Sumon'.

Upvotes: 1

Views: 418

Answers (1)

M Khalid Junaid
M Khalid Junaid

Reputation: 64476

You can use soundex it will compare if the sound of values in firstname matches to the sound of provided word

According to docs

When using SOUNDEX(), you should be aware of the following limitations:

  • This function, as currently implemented, is intended to work well with strings that are in the English language only. Strings in other
    languages may not produce reliable results.

  • This function is not guaranteed to provide consistent results with strings that use multi-byte character sets, including utf-8.

select *
from t
where soundex(firstname)=soundex('Suman')

Demo

Upvotes: 2

Related Questions