SQL Data Types

Every column has a declared type — it's what decides what values are valid and how they compare and sort.

What & Why

A column's data type constrains what can be stored in it and how operations like comparison, sorting, and arithmetic behave. This lesson series covers the major categories: numbers, text, boolean, and date/time — plus how to convert between them explicitly.

See How It Works

EXAMPLE TABLE — marketing.campaigns
idnamechannelspendstart_datestatus
1Spring Launchgoogle_ads55000.002024-01-15active
2Retention Webinaremail45000.002024-02-10active
3Finance Retargetinglinkedin50000.002024-03-12active
4Enterprise Searchgoogle_ads60000.002024-04-01active

Every column above already has a type: `spend` is a decimal number, `start_date` is a date, and `status` is text. The type makes `spend > 50000` a numeric comparison and makes `ORDER BY start_date` sort chronologically rather than alphabetically.

Beginner business practice

Sign up free to try it on a real business scenario