Re: Does MySQL have fuzzy matching or no?

From: Luuk <luuk_at_invalid.lan>
Date: Fri, 15 Dec 2017 21:20:26 +0100
Message-ID: <5a342e8b$0$10065$e4fe514c_at_news.xs4all.nl>


[Quoted] On 15-12-17 18:46, Lew Pitcher wrote:
> Lew Pitcher wrote:
>

>> bit-naughty_at_hotmail.com wrote:
>>
>>> I want to know - if there is a string, say, "poop" in a field in a table,
>>> and I want to match it against the string "doop", and have the search
>>> return successful - can I? How, please?
>>
>> If you are looking at strings that might sound similar if pronounced, then
>> you could use the SOUNDEX() function to match to a pre-determined value,
>> or the SOUNDS LIKE operator (which is, effectively, SOUNDEX(a) =
>> SOUNDEX(b) ) to match to something else.
>>   SELECT * FROM table
>>   WHERE field1 SOUNDS LIKE field2 ;

>
> As in
> SELECT * FROM table
> WHERE field1 SOUNDS LIKE 'doop';
>

[Quoted] What am i missing?

[root_at_test]> select * from test15;
+------+
| test |
+------+

| doop |
| pood |
| poop |

+------+
3 rows in set (0.00 sec)

[root_at_test]> select * from test15 where test sounds like 'doop'; +------+
| test |
+------+
| doop |
+------+
1 row in set (0.00 sec)
[root_at_test]> show create table test15;

+--------+-----------------------------------------------------------------------------------------------------------------------------+
| Table  | Create Table
                                                              |
+--------+-----------------------------------------------------------------------------------------------------------------------------+
| test15 | CREATE TABLE `test15` (
  `test` varchar(20) DEFAULT NULL,
  FULLTEXT KEY `t` (`test`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+--------+-----------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec) Received on Fri Dec 15 2017 - 21:20:26 CET

Original text of this message