MySQL QUOTE Function

MySQL QUOTE function is one of the String Functions, which returns a string enclosed by a single quotation mark. Or you can use this Quote function to escape the data value, i.e., backslash, single quote, ASCII NULL. Let us see how to write MySQL String QUOTE function with an example and the basic syntax of it is as shown below:


MySQL QUOTE Function Example

The QUOTE function escapes the backslash and single quote in a given string and returns the string surrounded by single quotations. The following query shows multiple ways to use this method.

SELECT QUOTE('Don\'t Do it');

SELECT QUOTE('Tutorial''Gateway');

SELECT QUOTE('Tutorial \'Gateway');
Quote Example 1

You can also use this one on a column Data. This MySQL example shows you how to use this method in the Email column.

SELECT FirstName,
FROM `MySQL Tutorial`.employe;
MySQL QUOTE Function 2

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.