Syntax error How to escape single quotes in MySQL?

How to escape single quotes in MySQL?



We can escape single quotes with the help of the SELECT statement. For instance, when single quotes are encountered in a name, eg. “Carol’s”.

Let us see the syntax.

SELECT ‘SomeValue’;

Here is an example that display how to include text with single quotes.

mysql> SELECT 'Carol\'s Taylor.';

The following is the output.

+-------------------+
| Carol's Taylor    |
+-------------------+
| Carol's Taylor    |
+-------------------+
1 row in set (0.00 sec)
Updated on: 2020-06-26T12:24:56+05:30

560 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements