Hi there, Could you please help me to find-out the solution? I need to use "LIKE" command of mysql. Below are title from a Product table. If i search for "Alarm" then it should show me result only for title which has word alarm. (0th and 2nd only) table_name = product Column_name = title 0 ->Casio G-Shock Velocity Indicator Alarm watch 1 ->Seiko Velatura Tachymeter Chronograph watch 2 ->Citizen promaster Alarm perpetual watch Thank you in anticipation
You should do something like SELECT title FROM product WHERE title LIKE '%alarm%' LIKE queries cause a table scan to find the rows - Once you table gets large, perhaps 10,000 rows you will see low performance and should look at Full Text search...
Hey thanks I got the solution. Below command gives all results having keywords Alarm or watch SELECT * FROM product where title LIKE '%Alarm%' or '%watch%' Code (markup):
If you're designing a table, you should initially use FULLTEXT indexes in order to make sure, later on when the table grows large you won't have to go back and do more work to fix the slow queries. Good practice is to optimize initially, and never have to re-code it.