A BLOB is binary large object that can hold a variable amount of data. Followings are some points about BLOB data type −
- BLOB is the family of column type intended as high-capacity binary storage.
- The actual BLOB column type is of four types-TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB.
- The four BLOB types are very similar to each other; the only difference is the maximum amount of data each can store.
Example − Following example shows how to declare a column as BLOB.
mysql> Create table stock(ID INT, Name VARCHAR(40), PHOTO BLOB, Quantity INT); Query OK, 0 rows affected (0.15 sec) mysql> Describe stock; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | ID | int(11) | YES | | NULL | | | Name | varchar(40) | YES | | NULL | | | PHOTO | blob | YES | | NULL | | | Quantity | int(11) | YES | | NULL | | +----------+-------------+------+-----+---------+-------+ 4 rows in set (0.03 sec)