The escape character. MySQL recognizes the following escape sequences
In a string, some sequences have special meanings. These sequences begin with a backslash (' \ '), the so-called escape character. MySQL recognizes the following escape sequences:
/
ASCII 0 (NUL) characters.
\‘
Single quotation mark ("').
\"
Double quotation marks (' "').
\b
Backspace
\ n
Line break.
\ r
Carriage return character.
\ t
The tab character.
\z
ASCII 26 (Control (Ctrl)-Z). The character can be encoded as ' \z ' to allow you to resolve the issue in Windows where ASCII 26 represents the end of the file. (If you try to use MySQL db_name < File_name,ascii 26 will cause problems).
\\
The backslash (' \ ') character.
\%
The '% ' character. See the annotations later in the table.
\_
The ' _ ' character. See the annotations later in the table.
These sequences are case-sensitive. For example, ' \b ' is interpreted as a backspace, but ' \b ' is interpreted as ' B '.
The ' \% ' and ' \_ ' sequences are used to search for '% ' and ' _ ' literal instances in a pattern matching environment that may be interpreted as a wildcard character. See section 12.3, 1, "string comparison function". Please note that if you use ' \% ' or ' \_ ' in other environments, they return the string ' \% ' and ' \_ ' instead of '% ' and ' _ '.
In other escape sequences, backslashes are ignored. In other words, the escape character is interpreted as if it were not escaped.
There are several ways to include quotation marks in a string:
· "" can be written in a string with the ' ' ' reference '.
· "'" can be written in a string using ' ' ' ".
· You can add an escape character (' \ ') before the quotation marks.
· Using ' ' referenced ' within a string does not require special handling and does not need to be double-character or escaped. Similarly, the use of ' ' referenced ' within a string does not require special handling.
The escape character _mysql recognizes the following escape sequence