I need to count the number of rows containing "'" APOSTROPHE in a particular field of my table. I made try to do so like below:
SELECT COUNT(*) FROM my_table WHERE field_name LIKE "%'%"
But I get 0 row in result. Whereas I am sure that "'" exists in many rows. So pls explain, how to count the number of rows containing apostrophe in MySQL?
You are doing right but one thing is missing. You can correct your query only to escape the apostrophe. I will rewrite your query like below:
SELECT COUNT(*) FROM my_table WHERE field_name LIKE "%\'%"