SQLBeginner#datatypes

CHAR vs VARCHAR vs TEXT?

CHAR(n) is fixed length and space padded, best for codes of constant size. VARCHAR(n) stores only what you use, up to n. TEXT stores large variable content, often off-page and not fully indexable.

Example
state CHAR(2),        -- 'TN'
email VARCHAR(120),  -- variable
bio TEXT             -- long free text

Related Questions

1
SQLAdvanced#performance

What is the difference between an execution plan and EXPLAIN ANALYZE?

Open
2
SQLAdvanced#performance

How do you optimise a slow SQL query?

Open
3
SQLAdvanced#scaling

What is partitioning and how does it differ from sharding?

Open