How do I create sql query for searching partial matches?

The Solution to How do I create sql query for searching partial matches? is


First of all, this approach won't scale in the large, you'll need a separate index from words to item (like an inverted index).

If your data is not large, you can do

SELECT DISTINCT(name) FROM mytable WHERE name LIKE '%mall%' OR description LIKE '%mall%'

using OR if you have multiple keywords.

~ Answered on 2011-08-24 09:22:18


Most Viewed Questions: