Storing 2-letter country codes as VARCHAR(50)? Use CHAR for fixed-length data to optimize storage.
When to Use CHAR:
-- Always exactly 2 characters CountryCode CHAR(2) -- 'US', 'UK', 'FR' -- Always exactly 1 character IsActive CHAR(1) -- 'Y' or 'N' -- Fixed format PhoneArea CHAR(3) -- '555', '212', '415'
When to Use VARCHAR:
-- Variable length Name VARCHAR(100) -- Could be 'John' (4 chars) or 'Alexander' (9 chars) Email VARCHAR(255) Description VARCHAR(MAX)
Storage Difference:
-- 1 million rows storing 'US' VARCHAR(50): 1M × 50 bytes = 50 MB CHAR(2): 1M × 2 bytes = 2 MB -- 25x less space with CHAR!
