githubEdit

levenshtein_distance

This section contains reference documentation for the levenshtein_distance function.

Returns the Levenshtein edit distance of string1 and string2, i.e. the minimum number of single-character edits (insertions, deletions or substitutions) needed to change string1 into string2.

Signature

levenshtein_distance(string1, string2) → bigint

Usage Examples

SELECT levenshtein_distance('kitten', 'sitting') AS value
FROM ignoreMe
value

3

SELECT levenshtein_distance('hello', 'world') AS value
FROM ignoreMe
value

4

SELECT levenshtein_distance('same', 'same') AS value
FROM ignoreMe
value

0

SELECT levenshtein_distance('', 'abc') AS value
FROM ignoreMe
value

3

SELECT levenshtein_distance('abc', '') AS value
FROM ignoreMe
value

3

Last updated

Was this helpful?