Learn SQL Lesson

Data Types

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.

Open interactive editor