A BLOB is a binary large object that can store a variable amount of data.
BLOB types are classified into TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. The maximum length of stored values is different for the four types.
BLOB values are treated as binary strings (or byte strings) that use the binary character set and collation. Comparison and sorting are based on the numeric values of bytes in the column values.
When strict SQL mode is not enabled, if the value assigned to a BLOB column exceeds the maximum length of the column, the excess part of the value is truncated, and an alert is generated. In strict SQL mode, if non-space characters are truncated, an error instead of an alert occurs, and the insertion of the value is prohibited.
TINYBLOB
The maximum length of a TINYBLOB column is 256bytes.
Each TINYBLOB value is stored with a one-byte prefix that indicates the number of bytes in the value. Syntax:
TINYBLOB
BLOB
The maximum length of a BLOB column is 65,536 bytes.
Each BLOB value is stored with a two-byte prefix that indicates the number of bytes in the value. You can specify an optional length M for a BLOB column. Syntax:
BLOB[(M)]
MEDIUMBLOB
The maximum length of a MEDIUMBLOB column is 16,777,216 bytes.
Each MEDIUMBLOB value is stored with a three-byte prefix that indicates the number of bytes in the value. Syntax:
MEDIUMBLOB
LONGBLOB
The maximum length of a LONGBLOB column is 50,331,648 bytes(48 MB). The maximum length of the LONGBLOB column also depends on the maximum packet size and available memory configured in the client/server protocol.
Each LONGBLOB value is stored with a four-byte prefix that indicates the number of bytes in the value. Syntax:
LONGBLOB