MySQL Learning--identifier syntax and naming conventions

Source: Internet
Author: User
Tags aliases

Transferred from: http://blog.csdn.net/notbaron/article/details/50868485

Welcome reprint, Reprint please indicate source: http://blog.csdn.net/notbaron/article/details/50868485

All SQL basically uses identifiers to refer to a database or its constituent elements.

unquoted identifiers can consist of uppercase letters A-Z, numbers 0-9, dollar signs, underscores, and Unicode extended characters ranging from u+0080 to U+FFFF.

unquoted identifiers are not allowed to be composed entirely of numeric characters, because that can be difficult to distinguish from numbers.

Identifiers can be quoted in anti-quotes, which is useful for SQL reserved words or for containing spaces or other special characters.

If SQL's ansi_quotes mode is enabled, you can use double quotation marks to enclose the identifier. Note

ANSI is the common standard for SQL, and quotes refers to what symbols are used to refer to objects.
Ansi_quotes is the standard method of SQL Reference, different databases in some single double quotes, as aliases, object names and other aspects of the notation are different.
Generally try to use ANSI standards, to ensure that the code is common, others can understand.

)

If Ansi_quotes mode is used, the string literal must be enclosed in single quotation marks.

Sql

SQL keywords and function names are not case-sensitive.

The database name, table name, and view name depend on the file name aspect of the operating system.

Stored programs are case-insensitive

Column names and index names are not case-sensitive

By default, table aliases are case-sensitive

The string is case-sensitive, depending on whether it is binary or non-binary.

To avoid capitalization problems, you can do this by selecting a case scenario and then following the schema to create the database and table.

Character

MySQL supports multiple character sets.

Character sets and collations can be set at multiple levels.

The command is as follows:

CHARACTER SET CharSet

COLLATE collation

For a table as follows:

CREATE TABLE tbl_name (...) CHARACTER Setcharset COLLATE collation;

Displays the available character sets and collation as follows:

SHOW CHARACTER SET;

SHOW COLLATION;

Unicode

The reason for supporting multiple character sets is that different languages specify different character encoding schemes, which can cause problems.

UNICODE provides a unified character encoding system.

Including: Utf8,utf16,utf32 and UCS2, etc.

MySQL Learning--identifier syntax and naming conventions

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.