I've created a database that contains a bunch of words such as itch
, mitch
, hell
. Is there any query I can make so that if given a variable, for example Mitchell
, it will return me the words it can find inside of it that also exist in the dB such as itch
, mitch
, hell
?
CodePudding user response:
You can achieve what you are after with locate()
In MySQL the following would work
SELECT
id,
word,
LOCATE(word, LOWER('Mitchell'))
FROM
words
WHERE LOCATE(word, LOWER('Mitchell')) > 0
You can play with it here: http://sqlfiddle.com/#!9/2fdd22b/2/0