:: DEVELOPER ZONE

    MySQL中文参考手册 9.2.1 标准的游戏 规则 合格的 标识 , 名字
MySQL 5.1 Reference Manual :: 9 Language Structure :: 9.2 Database, Table, Index, Column, and Alias Names :: 9.2.1 Identifier Qualifiers

  • MySQL 5.1 Reference Manual

  • 9.2 Database, Table, Index, Column, and Alias Names
  • 9.2.1 Identifier Qualifiers
  • 9.2.2 Identifier Case Sensitivity
  • 9.2.3 Mapping of Identifiers to Filenames


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_name The 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, write `my-table`.`my-column`, not `my-table.my-column`.
如果 任何 多部分 名字(multiple-part name) 要求 用引号quoting 是 `my-table`.`my-column`不是 `my-table.my-column`

What's point ?    这点  `     或 那点  ' 

请注意 是  `  This character is under Esc ,above Tab 叁考下面:除了VALUES ('烤地瓜'.......)不是 , 其他全部都是,但是 不是规定必须要用 这点  `........more
 而这点   '    (next to Enter 叁考下面:'烤地瓜'   或是 Lord's) ,叁考 loading-tables关於字串和日期的值 被规定要用引号

CREATE DATABASE `daily-food` 
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;


USE `daily-food` ;


CREATE TABLE `healthy-food` (
`早上` VARCHAR( 50 ) NULL ,
`中午` VARCHAR( 50 ) NOT NULL ,
`晚上` VARCHAR( 50 ) NULL 
) TYPE = innodb;


INSERT INTO `healthy-food` ( `早上` , `中午` , `晚上` ) 
VALUES (
'烤地瓜', '林光常にての健康餐', '全麦面包'
);

下面的例子 可看出 必须要用 这点  `   的情况

mysql> drop database daily-food ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '-food
' at line 1
mysql> drop database `daily-food` ;
Query OK, 1 row affected (0.06 sec)

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.






eMail real_vine@hotmail.com