BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:
* There is no trailing-space removal for BLOB and TEXT columns when values are stored or retrieved. Before MySQL 5.0.3, this differs from VARBINARY and VARCHAR, for which trailing spaces are removed when values are stored.
Note that TEXT is on comparison space extended to fit the compared object, exactly like CHAR and VARCHAR.
* For indexes on BLOB and TEXT columns, you must specify an index prefix length. For CHAR and VARCHAR, a prefix length is optional. See Section 7.4.3, “Column Indexes”.
* BLOB and TEXT columns cannot have DEFAULT values.
* There is no trailing-space removal for BLOB and TEXT columns when values are stored or retrieved. Before MySQL 5.0.3, this differs from VARBINARY and VARCHAR, for which trailing spaces are removed when values are stored.
Note that TEXT is on comparison space extended to fit the compared object, exactly like CHAR and VARCHAR.
* For indexes on BLOB and TEXT columns, you must specify an index prefix length. For CHAR and VARCHAR, a prefix length is optional. See Section 7.4.3, “Column Indexes”.
* BLOB and TEXT columns cannot have DEFAULT values.
本文探讨了BLOB和TEXT数据类型与VARBINARY及VARCHAR的区别。主要区别包括:存储和检索时不移除尾随空格、建立索引时必须指定前缀长度以及无法设置默认值等。
4849

被折叠的 条评论
为什么被折叠?



