English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

How to escape single quotes in MySQL?

We can escape single quotes using the SELECT statement. For example, when there is a single quote in the name, such as 'Carol\'s'.

Let's take a look at the syntax.

SELECT 'SomeValue';

This is an example of how to include text within 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)