I need to check the string with the column if the column contains that string or not.

example:String 'how to make pizza' and the column if has 'pizza' i need to fetch that.. like

SELECT * FROM event WHERE ('%how to make pizza%' LIKE EventName);

any idea plz..


3 Answers 3


You have to take into consideration the Full-Text Search Functions

Full-text searching is performed using MATCH() ... AGAINST syntax. MATCH() takes a comma-separated list that names the columns to be searched. AGAINST takes a string to search for, and an optional modifier that indicates what type of search to perform. The search string must be a string value that is constant during query evaluation. This rules out, for example, a table column because that can differ for each row.

The initial setup and configuration is very simple


You cannot check for a match against a part of your string. In order to accomplish your duty, you should split your original string. This may be done inside the query itself, provide you write some function that split your text, as explained in https://stackoverflow.com/questions/1096679/can-mysql-split-a-column . Once you split the string, you may compare every word with your eventname, using the like or = operator.


I'm not sure to understand, but if you just want to test if the value exists in the table, just use "EXISTS" and replace * by the ID column.

Else you can use the full text search function : CONTAINSTABLE Here is the documentation :


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.