Front-end knowledge

Source: Internet
Author: User

I. MySQL annotator

 

There are three MySQL annotators: 1 ,#... 2 ,"--... "note -- add a space 3 ,/*... */2. escape characters in MySQL/MySQLIdentify the following escape characters:

/0
One ASCII 0
(NUL) character.
/N
A newline character.
/T
A positioning character.
/R
A carriage return.
/B
A return character.

/'
A single quotation mark.
/& Quot;
A double quotation mark ("& quot.
//

A backslash.
/%
A "%" character. It is used to search for the text instance of "%" in the body. Otherwise, "%" is interpreted as a wildcard.
/_

A "_" character. It is used to search for the text instance of "_" in the body. Otherwise, "_" is interpreted as a wildcard.

Note: If you use "/%" or "/% _" in some body environments _", these will return strings "/%" and "/_" instead of "%" and "_".

★★

There are several methods to enclose quotation marks in a string:
1. Escape:

A string is referenced by a single quotation mark ('). The single quotation mark (') character in the string can be escaped by a single quotation mark.
A string is enclosed in double quotation marks"
& Quot; ". The" & quot; "character in the string can be escaped using the" & quot; "method.

At the same time, you can continue to use an escape character "/" to escape
2. Escape-free:
A string is enclosed in double quotation marks"
& Quot; ". The single quotation mark (') in this string does not need to be treated specially and does not need to be repeated or escaped.
Likewise,

A string is referenced by single quotes ('). The double quotation marks (& quot;) in this string do not need to be treated specially and do not need to be repeated or escaped.

The following SELECT statement demonstrates how quotes and escaping work:

MySQL> Select 'hello ','
& Quot; Hello & quot; ',' & quot; Hello & quot;
& Quot; ', 'hel' 'lo','/'hello ';

+ ---------- + -------------- + ------------------- + ---------- + --------- +

Hello & quot;
& Quot; hel'lo' hello

+ ---------- + -------------- + ------------------- + ---------- + --------- +

MySQL> Select & quot; Hello
& Quot;, & quot; 'hello' & quot;, & quot; 'hello' & quot ;,
& Quot; El & quot; lo & quot;, & quot;/& quot; Hello
& Quot;
+ ---------- + ----------- + ------------ + ----------- +

Hello 'hello' & quot; lo & quot; Hello

+ --------- + ----------- + ------------ + ----------- +

MySQL> Select
& Quot; this/NIS/nfour/nlines & quot ;;
+ -------------------- +
This

Is
Four
Lines
+ -------------------- +

 

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.