MySQL SOUNDS LIKE
SOUNDS LIKE
MySQL SOUNDS LIKE is used as SOUNDEX(expr) = SOUNDEX(expr) to retrieve strings sounds similar.
Soundex is a phonetic algorithm for indexing names after English pronunciation of sound.
Syntax:
expr1 SOUNDS LIKE expr2
MySQL Version: 8.0
Argument:
Name | Description |
---|---|
str | A string. |
Example: MySQL SOUNDS LIKE
The following MySQL statement returns all the rows which contain a student name which sounds like 'sudipto'. It returns two rows.
Code:
SELECT * FROM student
WHERE first_name SOUNDS LIKE 'sudipto' ;
Sample table: student
mysql> select * from student; +------+------------+-----------+-------+------------+ | id | first_name | last_name | marks | city | +------+------------+-----------+-------+------------+ | 1 | Sudipto | Sen | 93 | Kolkata | | 2 | Amit | Singh | 94 | Chandigarh | | 3 | Asif | Khan | 91 | Mumbai | | 4 | Vasant | Natarajan | 90 | Channai | | 5 | Amar | Sharma | 91 | Lucknow | | 6 | Sudipta | Roy | 92 | Delhi | | 7 | Anand | Rao | 88 | Bangalore | | 8 | Rahul | Gupta | 93 | Jaipur | +------+------------+-----------+-------+------------+ 8 rows in set (0.00 sec)
Output:
mysql> SELECT * FROM student -> WHERE first_name SOUNDS LIKE 'sudipto' ; +------+------------+-----------+-------+---------+ | id | first_name | last_name | marks | city | +------+------------+-----------+-------+---------+ | 1 | Sudipto | Sen | 93 | Kolkata | | 6 | Sudipta | Roy | 92 | Delhi | +------+------------+-----------+-------+---------+ 2 rows in set (0.00 sec)
Video Presentation:
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mysql/string-functions/mysql-sounds_like-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics