开发者

MYSQL: Difference between Binary and Blob

开发者 https://www.devze.com 2023-04-05 10:22 出处:网络
I\'m trying to understand mysql data types, but i don\'t get the difference between the (Var-)BINARY data fields and the BLOB-Fields. What ist the difference betwe开发者_运维技巧en these types?BLOB\'s

I'm trying to understand mysql data types, but i don't get the difference between the (Var-)BINARY data fields and the BLOB-Fields. What ist the difference betwe开发者_运维技巧en these types?


BLOB's can be as big as you want.

Also, reading the MySQL manual online:

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.

  • On comparisons, TEXT is 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.5.1, “Column Indexes”.

  • BLOB and TEXT columns cannot have DEFAULT values.


The binary and varbinary types are binary strings whose actual values are stored in the table. The actual values blob (and text) types are stored elsewhere in the database with a 256 byte alias to that slot being placed in the table; the blob can therefore be "any" size (up to the max).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号