Escape characters in MySQL statements

Source: Internet
Author: User

The escape characters in the MySQL language are basically the same as the various programming languages, as shown in the following table

Form Meaning
/ 0 (NUL) characters
\ n Line break
\ r Carriage return character
\ t Tabs
\b Backspace
\‘ Single quotation marks
\" Double quotes
\\ Reverse Slash
\% % character (used to differentiate% in pattern matching)
\_ _ Character (used to distinguish between _ in a pattern match)

To take one of the more ' \ n ' examples, execute the following SQL statement

As a result, everyone should know, but for the above figure, does everyone seem a little awkward?
Indeed, because we see not only the result of a newline, the expression in the SELECT statement also wraps, because the expression is displayed after processing, except that he is the same as the result.
There is another problem, is the quotation mark problem, I am very headache for the quotation marks, used often wrong, slowly analysis can make people confused
Let's look at one of the following examples

Where the fourth expression ' hel ' lo ' is in the middle of two single quotes
Or will everyone's doubts appear in the fourth expression? I'm not surprised by this, because once again the teacher asked us to add the appropriate path to a column (picture) in a table in the database, and then I
Believe sharp-eyed immediately found that the value of the column does not appear in the ' \ ' delimiter, I was thinking, this is why? If you use the path read from the database to find resources, it is certainly not found, the ghost know is that a string ' path string ' How to ' segmentation ', then how to solve it?
And then I tried the following example

Look, the separators come out, what is this for? I think it should be the database storage engine problem, in the use of the best use of two symbols, just in case

Escape characters in MySQL statements

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.