What is the key difference between CHAR and VARCHAR in MySQL?
A
CHAR allows NULL; VARCHAR does not allow NULL
B
CHAR is for Unicode; VARCHAR is ASCII only
C
CHAR stores numbers; VARCHAR stores text
D
CHAR is fixed-length; VARCHAR is variable-length
Correct answer
Correct answer
D. CHAR is fixed-length; VARCHAR is variable-length
21 views
⚔️
Challenge a friend on MySQL
Same MCQs, timed, live leaderboard. Send the link on WhatsApp – no sign-up needed.
Create challenge
Explanation
CHAR(n) always uses n characters, padding with spaces, which suits fixed codes such as country codes. VARCHAR(n) stores only the actual length plus a small prefix.
Reference
Asked in: NTS, Technical Interviews
Doubts & discussionNot sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ
‹ Previous MCQ Which MySQL function joins values from multiple rows of a group into one string? Next MCQ › What does prefixing a SELECT query with EXPLAIN do in MySQL?