(mysql.info) identifier-qualifiers
Info Catalog
(mysql.info) legal-names
(mysql.info) legal-names
(mysql.info) name-case-sensitivity
9.2.1 Identifier Qualifiers
---------------------------
MySQL allows names that consist of a single identifier or multiple
identifiers. The components of a multiple-part name should 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 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_NAMEThe column COL_NAME from table TBL_NAME of the
database DB_NAME.
If any components of a multiple-part name require quoting, quote them
individually rather than quoting the name as a whole. For example,
``my-table`.`my-column`' is legal, whereas ``my-table.my-column`' is
not.
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 database `db1' and from a table `t' in database `db2' in
the same statement, you must refer to columns in those tables as
`db1.t.col_name' and `db2.t.col_name'.
A word that follows a period in a qualified name must be an identifier,
so it is not necessary to quote it, even if it is a reserved word.
The syntax .TBL_NAME means the table TBL_NAME in the default database.
This syntax is accepted for ODBC compatibility because some ODBC
programs prefix table names with a ‘`.'’ character.
Info Catalog
(mysql.info) legal-names
(mysql.info) legal-names
(mysql.info) name-case-sensitivity
automatically generated byinfo2html