Which data type stores variable-length character values?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which data type stores variable-length character values?

Explanation:
Storing variable-length text is done with VARCHAR. It stores only as many characters as the actual value contains, up to a defined maximum, so strings of different lengths don’t waste space. CHAR, by contrast, uses a fixed length and pads shorter values to that length, which can waste space. Binary is for raw binary data, not text, and Date is for date values, not strings. Therefore, the data type best suited for variable-length character values is VARCHAR.

Storing variable-length text is done with VARCHAR. It stores only as many characters as the actual value contains, up to a defined maximum, so strings of different lengths don’t waste space. CHAR, by contrast, uses a fixed length and pads shorter values to that length, which can waste space. Binary is for raw binary data, not text, and Date is for date values, not strings. Therefore, the data type best suited for variable-length character values is VARCHAR.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy