Database Management MySQL Subjective
Oct 01, 2025

Explain the difference between CHAR and VARCHAR data types.

Detailed Explanation

CHAR:
• Fixed-length string
• Pads with spaces if shorter
• Faster for fixed-size data
• Maximum 255 characters

VARCHAR:
• Variable-length string
• Uses only required space
• Better for variable-size data
• Maximum 65,535 characters

Example:
name CHAR(10) -- Always uses 10 bytes
email VARCHAR(100) -- Uses actual length + 1-2 bytes

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback