I have a select where like query for a seach form which is as follows:
I think that the best solution would be to use Regular Expressions. It's cleanest and probably the most effective. Regular Expressions are supported in all commonly used DB engines.
In MySQL there is RLIKE
operator so your query would be something like:
SELECT * FROM buckets WHERE bucketname RLIKE "(?=.*apple)(?=.*and)(?=.*pear)"
Did't tested it, hope that my expression is right for MySQL regexp "dialect".
More on MySql regexp support:
http://dev.mysql.com/doc/refman/5.1/en/regexp.html#operator_regexp