SQL Text Data Types

VARCHAR, TEXT, and CHAR all hold text — the difference is length limits and padding behavior.

What & Why

VARCHAR(n) holds text up to n characters. TEXT holds text of any length, with no limit declared. CHAR(n) holds exactly n characters, padding shorter values with spaces.

See How It Works

TEXT TYPE BEHAVIOR
TypeBehavior
VARCHAR(50)Stores up to 50 characters; the campaign names shown here fit.
TEXTStores text without a declared length limit.
CHAR(10)Stores `Spring` with four trailing spaces so the value occupies 10 characters.

CHAR pads values to its fixed length. TEXT and VARCHAR are usually safer choices for variable-length business text.

Now You Try

Practice this concept

Marketing wants active campaign names and channels, demonstrating exact text filtering.

Available schema
marketing

Prefix tables with marketing.table_name.

namechannelstatus
marketing.campaigns
ColumnType
idinteger
nametext
channeltext
spendnumeric
start_datedate
end_datedate
statustext
target_segmenttext
legacy_idtext
query.sql
Beginner business practice

Sign up free to try it on a real business scenario