How to add levenshtein function in mysql?

Sandesh Sharma picture Sandesh Sharma · Dec 17, 2012 · Viewed 31.9k times · Source

I got the code for levenshtein distance for mysql form "http://kristiannissen.wordpress.com/2010/07/08/mysql-levenshtein/" but, how to add that function in mysql? I am using xampp and i need it for search in php.

Answer

mvp picture mvp · Dec 17, 2012

I have connected to my MySQL server and simply executed this statement in MySQL Workbench, and it simply worked - I now have new function levenshtein().

For example, this works as expected:

SELECT levenshtein('abcde', 'abced')

2