What is the difference between VARCHAR and CHAR?

VARCHAR and CHAR are both string column types, but they differ in how they store and pad data -- VARCHAR stores variable-length strings using only the space needed, while CHAR always reserves and pads to a fixed length.

Key Points

Example

A product name column benefits from VARCHAR(50) since names vary in length, while a fixed two-letter country code column is a natural fit for CHAR(2) since every value is exactly the same size.

CREATE TABLE employees (
    name VARCHAR(50),
    code CHAR(10)
);

Interview Tip

A concise interview answer is

VARCHAR stores variable-length strings and only uses the space the data actually needs, while CHAR is fixed-length and pads shorter values with spaces up to the declared size. I use VARCHAR for most text like names, and CHAR only for genuinely fixed-width data like country or status codes.

Last updated: 11 November 2026

Previous question: What is the difference between DROP and TRUNCATE?

Next question: What is the difference between IN and EXISTS in SQL?

More SQL interview questions

All SQL questions