Chapter 0 · Lesson 2 of 3

Data Types

See how SQL data types such as text, integers, decimals, dates, and booleans decide which comparisons, math, and sorting work on a column.

Every column in a table stores a specific kind of data. These are called data types. The most common ones are:

• Text — words and characters, like a name or department ("Alice", "Engineering") • Numbers — whole numbers or decimals, like an ID or salary (1, 95000.00) • Dates — calendar values like a hire date (2021-03-15)

Why does this matter? The type determines what you can do with the data. You can calculate an average salary because it is a number, sort employees by hire date because it is a date, but you cannot add two names together — that would not make sense.

Consider a table with these columns:

• id — number (INTEGER) • name — text (VARCHAR) • department — text (VARCHAR) • salary — number (DECIMAL) • hire_date — date (DATE)

In the next chapter you will learn your first steps with SQL — the language used to ask questions about data stored in tables like this.

This lesson is theory-focused. Read it, then mark it complete in the Learn SQL panel before moving on.

Open this lesson in the SQL editor

Lessons in Understanding Data

Build the mental model behind SQL: how tables store rows and columns, why data types matter, and how missing values work with NULL.

  1. 01 · Tables, Rows, and Columns
  2. 02 · Data Types
  3. 03 · Missing Values with NULL

Related guides