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