Skip to content

MEDIUMBLOB

CREATE TABLE employees (
id INT AUTO_INCREMENT,
resume MEDIUMBLOB,
PRIMARY KEY (id)
);
INSERT INTO employees (resume)
VALUES (LOAD_FILE('/tmp/resume.pdf'));
Query OK, 0 rows affected (0.04 sec)
Query OK, 1 row affected (0.01 sec)

In the above example, a table ‘employees’ is created with a MEDIUMBLOB data type column named ‘resume’. Then, a PDF file located at ‘tmp/resume.pdf’ on the server is inserted into the ‘resume’ column of the ‘employees’ table. The MEDIUMBLOB data type is capable of storing binary data up to 16MB, making it suitable for storage of larger files such as images, audio, or PDFs within the database.