MySQL QUOTE() Function
In MySQL, the QUOTE()
function returns a string enclosed in single quotes. The QUOTE()
function will escape '
and \
.
QUOTE()
Syntax
Here is the syntax of MySQL QUOTE()
function:
QUOTE(string)
Parameters
string
- Required. A string.
Return value
The QUOTE(string)
function returns a string surrounded by single quotes.
The function will return NULL
if any parameter is NULL
.
QUOTE()
Examples
Here are some examples of MySQL QUOTE()
function.
SELECT
QUOTE('Let''s go!'),
QUOTE('Let\'s go!'),
QUOTE(NULL)\G
QUOTE('Let''s go!'): 'Let\'s go!'
QUOTE('Let\'s go!'): 'Let\'s go!'
QUOTE(NULL): NULL