In some cases, MySQL silently changes column specifications from those given in a 在某些情况下,MySQL会以静默方式更改CREATE TABLE or ALTER TABLE statement. CREATE TABLE或ALTER TABLE语句中给出的列规范。These might be changes to a data type, to attributes associated with a data type, or to an index specification.这些可能是对数据类型、与数据类型关联的属性或索引规范的更改。
All changes are subject to the internal row-size limit of 65,535 bytes, which may cause some attempts at data type changes to fail. 所有更改都受到65535字节的内部行大小限制,这可能会导致某些数据类型更改尝试失败。See Section 8.4.7, “Limits on Table Column Count and Row Size”.请参阅第8.4.7节,“表列计数和行大小限制”。
Columns that are part of a 作为PRIMARY KEY are made NOT NULL even if not declared that way.PRIMARY KEY一部分的列即使未以这种方式声明,也将被设置为NOT NULL。
Trailing spaces are automatically deleted from 创建表时,将自动从ENUM and SET member values when the table is created.ENUM和SET成员值中删除尾随空格。
MySQL maps certain data types used by other SQL database vendors to MySQL types. MySQL将其他SQL数据库供应商使用的某些数据类型映射到MySQL类型。See Section 11.9, “Using Data Types from Other Database Engines”.请参阅第11.9节,“使用来自其他数据库引擎的数据类型”。
If you include a 如果包含USING clause to specify an index type that is not permitted for a given storage engine, but there is another index type available that the engine can use without affecting query results, the engine uses the available type.USING子句以指定给定存储引擎不允许的索引类型,但引擎可以使用另一种索引类型而不影响查询结果,则引擎将使用该可用类型。
If strict SQL mode is not enabled, a 如果未启用严格SQL模式,则长度规格大于65535的VARCHAR column with a length specification greater than 65535 is converted to TEXT, and a VARBINARY column with a length specification greater than 65535 is converted to BLOB. VARCHAR列将转换为文本,长度规格大于65535的VARBINAL列将转换为BLOB。Otherwise, an error occurs in either of these cases.否则,在这两种情况下都会发生错误。
Specifying the 为字符数据类型指CHARACTER SET binary attribute for a character data type causes the column to be created as the corresponding binary data type: CHAR becomes BINARY, VARCHAR becomes VARBINARY, and TEXT becomes BLOB. CHARACTER SET binary属性会导致将列创建为相应的二进制数据类型:CHAR变为BINARY,VARCHAR变为VARBINARY,TEXT变为BLOB。For the 对于ENUM and SET data types, this does not occur; they are created as declared. ENUM和SET数据类型,不会发生这种情况;它们是按声明的方式创建的。Suppose that you specify a table using this definition:假设使用此定义指定一个表:
CREATE TABLE t
(
c1 VARCHAR(10) CHARACTER SET binary,
c2 TEXT CHARACTER SET binary,
c3 ENUM('a','b','c') CHARACTER SET binary
);
The resulting table has this definition:
CREATE TABLE t
(
c1 VARBINARY(10),
c2 BLOB,
c3 ENUM('a','b','c') CHARACTER SET binary
);To see whether MySQL used a data type other than the one you specified, issue a 要查看MySQL是否使用了您指定的数据类型以外的数据类型,请在创建或更改表后发出DESCRIBE or SHOW CREATE TABLE statement after creating or altering the table.DESCRIBE或SHOW CREATE TABLE语句。
Certain other data type changes can occur if you compress a table using myisampack. 如果使用myisampack压缩表,则可能会发生某些其他数据类型更改。See Section 16.2.3.3, “Compressed Table Characteristics”.请参阅第16.2.3.3节,“压缩表特性”。