Sunday, 11 August 2013

Mysql : best way to return "champion" that exists in a table in case the given query "championship" is not found

Mysql : best way to return "champion" that exists in a table in case the
given query "championship" is not found

I have a very big table with strings. field "words" : dog champion cat
this is a cat pool champ boots ...
In my example, if a select query is looking for the given string
"championship", it won't find it because this string is not in the table.
In that case, I want the query to return "champion" from the table, ie the
longest string in the table that begins the given word "championship".
Question : I want to return longest string in table that starts a given
string.
I need high speed. Is there a way to create index and query in order to
have fast execution of queries ?
Thank you for your help

No comments:

Post a Comment