The single quote and apostrophe (s) are commonly used with any kind of text data.
To escape or ignore the single quote is a common requirement for all database developers.
In this post, I am sharing solution for MySQL Database Server.
MySQL Server has actually two options to escape single quote. You can replace single quote to double single quote like (”) and the other is you can use (\’) to escape single quote.
First, Create a sample table:
CREATE TABLE tbl_SingleQuoted
Insert some sample data with single quote using both (”) and (\’):
INSERT INTO tbl_SingleQuoted
,(3,'The dbrnd Blog''s Reviews');
To SELECT all data which has ( ‘s ):
WHERE TextData LIKE '%\'s%';
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.