Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> MySQL

Tìm kiếm theo phát âm tương tự với SOUNDS LIKE trong MySQL

Toán tử SOUNDS LIKE

So sánh hai biểu thức dựa trên **phát âm tiếng Anh** (Soundex). Cú pháp:

Expression1 SOUNDS LIKE Expression2

Ví dụ

Tìm tên phát âm giống "hrst" (≈ Harshit):

mysql> SELECT Id, Name, Address, Subject FROM student WHERE name SOUNDS LIKE 'hrst';
+------+---------+---------+----------+
| Id   | Name    | Address | Subject  |
+------+---------+---------+----------+
| 15   | Harshit | Delhi   | Commerce |
+------+---------+---------+----------+

MySQL dùng thuật toán Soundex để so sánh phát âm.