Câu hỏi phỏng vấn MySQL
Câu hỏi

Describe BLOB in MySQL. What is it used for?

Câu trả lời

A BLOB, or Binary Large Object, in MySQL is a data type specifically designed to store large amounts of binary data. This binary data can include files such as images, multimedia (audio and video), PDF documents, and other binary formats[1][3][4][5][7][8].

Usage of BLOB in MySQL

BLOBs are primarily used in scenarios where there is a need to store files directly in the database rather than storing file paths. This approach is beneficial in several ways:

  1. Data Integrity and Consistency: Storing files directly in the database ensures that the files are in sync with the rest of the database content. This is particularly useful in applications like content management systems, where ensuring data consistency is crucial[8].

  2. Security: Since BLOB data is stored within the database, it benefits from the database's security measures. Access to the data can be controlled based on database permissions, which is more secure than file system permissions[2][8].

  3. Backup and Recovery: When backups are performed on the database, BLOB data is included automatically. This simplifies the backup process because there's no need to separately backup files stored outside the database[2][8].

  4. Portability: Having all data, including binary files, stored within a single database makes the system more portable. The database can be moved or replicated without having to handle external files separately[8].

Technical Details

In MySQL, BLOB is a group of binary data types that differ mainly in size and storage capacity. There are four types of BLOBs:

  • TINYBLOB: Maximum length of 255 bytes.
  • BLOB: Maximum length of 65,535 bytes (approximately 64KB).
  • MEDIUMBLOB: Maximum length of 16,777,215 bytes (approximately 16MB).
  • LONGBLOB: M...
junior

junior

Gợi ý câu hỏi phỏng vấn

middle

What is index in MySQL? What is advantage of index?

expert

What is difference between horizontal and vertical partitioning? Does MySQL support both horizontal
and vertical partitioning?

junior

How are VARCHAR and CHAR different. Talk about cases where you will use one over other.

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào