Home >Database >Mysql Tutorial >What is the correct structure for searching in MySQL using SOUNDEX()?

What is the correct structure for searching in MySQL using SOUNDEX()?

王林
王林forward
2023-09-07 10:13:131162browse

使用 SOUNDEX() 在 MySQL 中搜索的正确结构是什么?

Basically, the SOUNDEX() function is used to return Soundex, a phonetic algorithm used to index names, strings of strings, after the English pronunciation of sounds . The correct structure for searching in 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)

SOUNDEX(‘harshit’) and SOUNDEX(‘hrst’) have the same result because both words have the same pronunciation.

The above is the detailed content of What is the correct structure for searching in MySQL using SOUNDEX()?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete