"LIKE" command of mysql for searching?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
rahulephp
Forum Commoner
Posts: 28
Joined: Mon Oct 05, 2009 11:05 am

"LIKE" command of mysql for searching?

Post by rahulephp »

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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: "LIKE" command of mysql for searching?

Post by Christopher »

% is the wildcard character form LIKE, so:

SELECT title FROM product WHERE title LIKE '%Alarm%';
(#10850)
Post Reply