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 editorLessons 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.
Related guides
What Is a Database Table? Rows, Columns, and the Mental Model Behind SQL
Before SQL feels natural, you need one simple mental model: tables are structured collections of records with predictable columns.
SQL Data Types Explained: Text, Numbers, Dates, and Better Questions
Data types are the reason SQL knows the difference between a name, a salary, and a hire date — and that difference shapes every query you write.
SQL NULL Explained: How Missing Values Work and Why They Matter
NULL is SQL's way of saying a value is missing or unknown — and it behaves differently from almost every other value beginners expect.