Mysql's escape character "/"
MySQL identifies the following escape characters:
/ 0
A ASCII 0 (NUL) character.
/ N
A new line.
/ t
A locator.
/ r
A carriage return.
/ B
A escape.
/ '
A single quotes ("'").
/ "
A dual quotation mark ("" ").
//
A backslash ("/").
/%
A "%" character. It is used to search "%" text instance in the body, otherwise "%" will be construed as a wildcard.
/ _
A "_" character. It is used to search for "_" text instance in the body, otherwise "_" will be interpreted as a wildcard.
Note that if you use "/%" or "/% _" in some textures, these will return strings "/%" and "/ _" rather than "%" and "_".
★★
There are several ways to include quotation marks in a string:
1, must escape:
A string is referenced by single quotation marks "'", the single quotes "'" characters in the string can escape with the "''" mode.
A string is referenced by dual quotation marks "" "," "" "characters in this string can be escaped in" "".
At the same time, you can continue to use a escape character "/" to escape
2, can not be used:
A string is referenced by dual quotation marks "" ", the single quotes" '"in this string do not need special treatment and do not have to be repeated or escaped.
Similarly,
A string is referenced by single quotation marks "'", the dual quotes "" "in this string do not require special treatment and do not have to be repeated or escaped.
How does the SELECT demo quotation marks and escapes shown below work:
MySQL> Select 'Hello', '"Hello",' "" Hello "',' Hel''lo ',' / 'Hello';
-------- -------------- ---------------- --- ------- ---------
| Hello | "Hello" | "Hello" | Hel'LO | 'Hello |
-------- -------------- ---------------- --- ------- ---------
MySQL> SELECT "Hello", "'Hello'", "'' Hello ''", "Hel" "LO", "/" Hello ";
-------- ---------- ---------- - ---------
| Hello | 'Hello' | '' Hello '' | Hel "LO |" Hello |
--------- --------- --------- ------------ - ---------
MySQL> SELECT "this / nis / nFour / nlines"; --------------------
| This
IS
Four
Lines |
------------------
★★
If you want to insert binary data into a BLOB column, the following characters must be represented by the escape sequence:
NUL
ASCII 0. You should use '/ 0' (a backslash and an ASCII '0') to represent it.
/
ASCII 92, reverse slope. Expressed with '//'.
'
ASCII 39, single quotes. Expressed with "/ '".
"
ASCII 34, double quotes. Use "/" ".