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

What is difference between BLOB and TEXT in MySQL?

Câu trả lời

In MySQL, BLOB (Binary Large Object) and TEXT are both data types used for storing large amounts of data, but they cater to different types of data and have distinct characteristics:

  1. Data Type:

    • BLOB: Designed for storing binary data. This includes data that does not fit traditional character-based systems, such as images, audio files, executable files, and any multimedia files[1][2][3][4][5].
    • TEXT: Intended for storing large strings of text. This can include documents, JSON data, articles, emails, logs, and other text-based content[1][2][3][4][5].
  2. Character Set and Collation:

    • BLOB: Does not have a character set. It treats data as binary strings (byte strings), and sorting and comparison are based on the numeric values of the bytes in column values[2][5].
    • TEXT: Has a character set, and sorting and comparison are based on the collation of that character set. This means TEXT values are treated as nonbinary strings (character strings)[2][5].
  3. Use Cases:

    • BLOB: Best suited for storing binary format files or data where the preservation of the exact binary data is required. Common use cases include document storage, image galleries, or applications requiring access to raw binary data[1].
    • TEXT: More suited for text-based content where character set compatibility is important. This makes it easier for text manipulation and searching within the database[1].
  4. Performance Considerations:

    • The performance between BLOB and TEXT can vary depending on the operations performed. For operations involving text manipulation, like search queries, TEXT may perform...
middle

middle

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

middle

What happens if a parent row which is referenced by child row is being deleted in case of foreign key constraint?

middle

What is mysqldump ?

expert

Why you should never use GUIDs as part of clustered index?

Bình luận

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

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