Updated on 2023-10-25 GMT+08:00

levenshtein

This function is used to returns the Levenshtein distance between two strings, for example, levenshtein('kitten','sitting') = 3.

Levenshtein distance is a type of edit distance. It indicates the minimum number of edit operations required to convert one string into another.

Syntax

levenshtein(string A, string B)

Parameters

Table 1 Parameter

Parameter

Mandatory

Type

Description

A, B

Yes

STRING

String to be entered for calculating the Levenshtein distance

Return Values

The return value is of the INT type.

Example Code

The value 3 is returned.

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