Identifier Qualifiers
753
The following table describes the maximum length for each type of identifier.
Identifier
Maximum Length (characters)
Database
64
Table
64
Column
64
Index
64
Constraint
64
Stored Procedure or Function
64
Trigger
64
View
64
Alias
256 (see exception following table)
Compound Statement Label
16
As of MySQL 5.0.52, aliases for column names in
CREATE VIEW
statements are checked against the
maximum column length of 64 characters (not the maximum alias length of 256 characters).
Identifiers are stored using Unicode (UTF-8). This applies to identifiers in table definitions that are
stored in
.frm
files and to identifiers stored in the grant tables in the
mysql
database. The sizes of
the identifier string columns in the grant tables are measured in characters. You can use multi-byte
characters without reducing the number of characters permitted for values stored in these columns,
something not true prior to MySQL 4.1. As indicated earlier, the permissible Unicode characters are
those in the Basic Multilingual Plane (BMP). Supplementary characters are not permitted.
9.2.1. Identifier Qualifiers
MySQL permits names that consist of a single identifier or multiple identifiers. The components of a
multiple-part name must be separated by period (“
.
”) characters. The initial parts of a multiple-part
name act as qualifiers that affect the context within which the final identifier is interpreted.
In MySQL, you can refer to a table column using any of the following forms.
Column Reference
Meaning
col_name
The column
col_name
from whichever table used in the statement
contains a column of that name.
tbl_name.col_name
The column
col_name
from table
tbl_name
of the default database.
db_name.tbl_name.col_name
The column
col_name
from table
tbl_name
of the database
db_name
.
The qualifier character is a separate token and need not be contiguous with the associated identifiers.
For example,
tbl_name.col_name
and
tbl_name . col_name
are equivalent.
If any components of a multiple-part name require quoting, quote them individually rather than quoting
the name as a whole. For example, write
`my-table`.`my-column`
, not
`my-table.my-
column`
.
A reserved word that follows a period in a qualified name must be an identifier, so in that context it
need not be quoted.
You need not specify a
tbl_name
or
db_name.tbl_name
prefix for a column reference in a
statement unless the reference would be ambiguous. Suppose that tables
t1
and
t2
each contain
a column
c
, and you retrieve
c
in a
SELECT
statement that uses both
t1
and
t2
. In this case,
c
is
ambiguous because it is not unique among the tables used in the statement. You must qualify it with a
table name as
t1.c
or
t2.c
to indicate which table you mean. Similarly, to retrieve from a table
t
in
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...