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: