Updated on 2026-11-06 GMT+08:00

levenshtein

The levenshtein function is used to return the Levenshtein distance between two strings. For example, levenshtein('kitten','sitting') = 3.

The Levenshtein distance is a type of edit distance. It refers to the minimum number of single-character edits required to change one string into the other.

Syntax

levenshtein(string A, string B) 

Parameters

Parameter

Mandatory

Type

Description

A, B

Yes

STRING

The strings required for calculating the Levenshtein distance.

Return Values

Returns a value of type INT.

Example Code

Returns 3.

SELECT levenshtein('kitten','sitting');