Paper.J
Paper.J

Reputation: 13

How to check %match between 2 string in prestosql?

What im looking for is I have 2 words e.g. 'Family' and 'Family Tree'

then I would love to know that how much does both texts match to each others.

let say 'Family' and 'Family' >> 100 %

not sure any workaround or not.

Thank you so much.

Upvotes: 1

Views: 2016

Answers (2)

Guru Stron
Guru Stron

Reputation: 141730

For presto you can try looking into levenshtein_distance(string1, string2) → bigint built in 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.

Or (though it seems less suitable) hamming_distance(string1, string2) → bigint:

Returns the Hamming distance of string1 and string2, i.e. the number of positions at which the corresponding characters are different. Note that the two strings must have the same length.

Upvotes: 0

Piyush Kachhadiya
Piyush Kachhadiya

Reputation: 612

you can use like.

select * from tablename where fildname like '%Family%'

Result Give you all row in keyword is Family present.

Upvotes: 0

Related Questions