Which data type is more suitable for storing "documents" in Mysql?
A. Varchar
B. Longtext
C. Mediumtext
D. Either Varchar or Longtext
Answer: Option B
Solution (By Examveda Team)
This question is about how to store big chunks of information, like entire documents, in a MySQL database. Let's look at the options:Option A: Varchar
Varchar is good for storing short strings of text, like names or addresses. It's not the best choice for storing entire documents because it has a limited length.
Option B: Longtext
Longtext is designed to store large amounts of text data, making it suitable for documents. It can hold up to 4 GB of text!
Option C: Mediumtext
Mediumtext is similar to Longtext but with a smaller capacity. It can hold up to 16 MB of text, which is still plenty for many documents.
Option D: Either Varchar or Longtext
This option is incorrect. Varchar is not suitable for storing large documents due to its limited length.
The Answer:
The most suitable data type for storing documents in MySQL is Longtext because it can hold a vast amount of data. If your documents are smaller, Mediumtext could also be a good option.
In short: For storing documents, you need a data type that can handle large amounts of text data. Longtext and Mediumtext are designed for this purpose.

Join The Discussion