LEVENSHTEIN_DISTANCE
All functions > STRING > LEVENSHTEIN_DISTANCE
Calculates the Levenshtein (edit) distance between two strings.
Syntax
LEVENSHTEIN_DISTANCE(expr1, expr2)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string1 | VARCHAR | Yes | First string to compare |
string2 | VARCHAR | Yes | Second string to compare |
Returns
Minimum number of single-character edits (insertions, deletions, substitutions) required to change one string into the other
Notes
- Also known as edit distance
- Case-sensitive comparison
- Unlike Hamming distance, strings can be different lengths
- Useful for fuzzy string matching and spell checking