Escape Characters
Escape Character Table
Character Sequence | Represents Character |
---|---|
\' | Single quote ' |
\" | Double quote " |
\n | Newline character |
\r | Carriage return |
\t | Tab character |
\\ | Backslash \ |
\% | % see below for rules |
\_ | _ see below for rules |
Rules for Using Escape Characters
- Identifiers contain escape characters (database names, table names, column names, aliases)
- Regular identifiers: Directly prompt an error for the identifier, because identifiers are required to be numbers, letters, and underscores, and cannot start with a number.
- Backtick `` identifiers: Keep as is, do not escape
- Data contains escape characters
- Encountering the defined escape characters will trigger escaping (
%
and_
see below), if there is no matching escape character, the escape symbol\
will be ignored (\x
remains as is). - For
%
and_
, since these two characters are wildcards inlike
, use\%
and\_
in pattern matchinglike
to represent the characters%
and_
themselves. If\%
or\_
are used outside thelike
pattern matching context, their results are the strings\%
and\_
, not%
and_
.
- Encountering the defined escape characters will trigger escaping (