What is the role of "'" in SQL?

Source: Internet
Author: User
What is the role of the 'symbol after {code...} from when someone else's code is seen? Seeing others' code,

'Select'. $ param ['field']. 'from'. DBPRE. $ param ['table']

What is the role of the 'symbol after "from?

Reply content:

Seeing others' code,

'Select'. $ param ['field']. 'from'. DBPRE. $ param ['table']

What is the role of the 'symbol after "from?

All databases have similar settings, but mysql only uses. It is usually used to describe the database name, table name, and field name. For example

Select from table;

The first from is the field name, and the last table is also the field name, but it is also the mysql keyword, so an error will be reported during execution, so you should use

Select 'from 'from 'table'

We do not recommend that you use keywords as field names or table names for ease of reading. At the same time, we recommend that you use a pair of reverse quotation marks for database names, table names, and field names.

To avoid conflicts with keywords, it is to tell mysql that there is a common string, not a command.

Avoid conflicts with mysql keywords. Therefore, use this symbol to enclose it. Although it does not affect query, it is best to add

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.