TINYBLOB

TINYBLOB is a binary large object that can hold a small amount of data. As a type of BLOB datatype, it stores binary data, making it suitable for storing bytes of information like images, audio, and video. Specifically, it can store up to 255 bytes of data. All BLOB types are treated as binary strings and TINYBLOB is the smallest of them. One should take note that these types of data are not comparable or sortable.

Example

CREATE TABLE employee_data(
id INT AUTO_INCREMENT,
data TINYBLOB,
PRIMARY KEY (id)
);
INSERT INTO employee_data(data) VALUES (CAST('This is TINYBLOB data' AS BINARY));

Output

Query OK, 1 row affected (0.00 sec)

Explanation

In the example provided, a table named employee_data is created with two columns: id and data. The id column is an integer type with the AUTO_INCREMENT attribute, making it the primary key for the table. The data column is of type TINYBLOB.

A row is then added to the employee_data table, with the TINYBLOB data column storing the binary data equivalent of the string ‘This is TINYBLOB data’. The output shows that the row insertion was successful.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.