MySQL Tutorial/String Functions/QUOTE

Материал из SQL эксперт
Перейти к: навигация, поиск

QUOTE(NULL);

mysql>
mysql> SELECT QUOTE(NULL);
+-------------+
| QUOTE(NULL) |
+-------------+
| NULL        |
+-------------+
1 row in set (0.00 sec)
mysql>
mysql>


QUOTE(str): Quote(str) produce a result that can be used as a properly escaped data value in an SQL statement

If the argument is NULL, the return value is the word "NULL" without enclosing single quotes.



mysql>
mysql>
mysql> SELECT QUOTE("Don\"t!");
+------------------+
| QUOTE("Don\"t!") |
+------------------+
| "Don\"t!"        |
+------------------+
1 row in set (0.00 sec)
mysql>