MySQL database technology (12) [group chart] _ MySQL

Source: Internet
Author: User
MySQL database technology (12) [group chart] 3.2 MySQL naming rules

Almost every SQL statement involves a database or its composition to some extent. This section describes the syntax rules for referencing databases, tables, columns, indexes, and aliases. The name is case sensitive and is also described here.

3.2.1 Reference Database components

When a database is referenced by a name, it is limited by the characters that can be used and the length that the name can have. The name format also depends on the context in which they are used:

■ Available characters in the name. The name can be composed of any letter, number, "_", and "$" in the character set used by the server. The name can start with a number based on any of the preceding characters. However, names cannot be composed of numbers separately, because they are mixed with numerical values. The name provided by MySQL starts with a number. If such a name is used, pay special attention to the names containing "E" and "e", because these two characters may lead to confusion with expressions. 23e + 14 indicates column 23e plus 1 4, but what does 23e + 14 indicate? Does it represent the number represented by a scientific notation?

■ Name length. The names of databases, tables, columns, and indexes can contain a maximum of six or four characters. An alias can contain up to 256 characters.

■ Name qualifier. To reference a database, you only need to specify its name, for example:

Db_name indicates the name of the database to be referenced. To reference a table, you can select either. One option is to use a fully qualified table name composed of a database name and table name, for example:

Tbl_name indicates the name of the table to be referenced. Another option is to reference a table in the default (current) database by the table name itself. If samp_db is a table in the default database, the following two statements are equivalent:

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.