Mysql Data Warehousing Special character processing detailed _mysql

Source: Internet
Author: User

In a string, if a sequence has a special meaning, each sequence begins with a backslash (""), called an escape character. MySQL recognizes the following escape characters:

0
An ASCII 0 (NUL) character.
'
An ASCII 39 single quotation mark ("'") character.
"
An ASCII 34 double quote ("") character.

An ASCII 8 backspace.
An ASCII 10 line feed character.
R
An ASCII 13 back-car character.
T
An ASCII 9 tab (tab).
Z
ASCII (control-z). This character can be handled in Windows system ASCII (26) represents the end of a file problem. (ASCII (26) may cause problems when using MySQL database < filename. )
An ASCII 92 backslash ("") character.
%
An ASCII 37 "%" character. It is used to search for text instances of "%" in the body, otherwise this "%" will be interpreted as a wildcard character.
_
An ASCII 95 "_" character. It is used to search for text instances of "_" in the body, otherwise this "_" will be interpreted as a wildcard character.
Note If you use "%" or "_" in some body contexts, you will return the string "%" and "_" instead of "%" and "_".

There are several ways in which a string can contain quotes:

A string is referenced in single quotation marks "'", and the single quote "'" character in the string can be escaped with "".

A string is referenced in double quotation marks "", and the character "" in the string can be escaped by using the "" ".

You can also continue to use the escape character "" in front of the quotes to escape the way.

A string is quoted in double quotes "" "and the single quotation mark in the string" ' "does not require special treatment and does not have to be duplicated or escaped. Similarly, a string is referred to as a single quote "'", and the double quotation mark "" In the string does not require special treatment and does not have to be duplicated or escaped.

The following shows how the SELECT demo quotes and escapes work:

mysql> SELECT ' hello ', ' hello ' ', ' ' Hello ' ', ', ' Hel ' ' lo ', ' Hello

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.