1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00
Files
til/postgres/compute-the-levenshtein-distance-of-two-strings.md

512 B

Compute The Levenshtein Distance Of Two Strings

PostgreSQL has a built-in function for computing the Levenshtein distance between two strings.

> select levenshtein('hello', 'world');
 levenshtein
-------------
           4

> select levenshtein('function', 'funtcion');
 levenshtein
-------------
           2

Check out the fuzzystrmatch module for more details.