Is 10 bigger than 9?
Sort the numbers 9, 10 and 100 as numbers, and you get 9, 10, 100. Sort them as text, and you get 10, 100, 9.
The same marks give two answers. What decides is the type of data. Every column needs the right type, or a calculation can go wrong.
Key words
| Word | What it means | Example |
|---|---|---|
| Data type | The kind of value a field holds, which decides what you can do with it. | Whole number or text |
| Integer | A whole number with no decimal part. | 14 |
| Float | A number with a decimal point, stored in a small space. | 2.5 |
| Double | A decimal number stored with more digits of accuracy than a float. | 3.14159265 |
| Boolean | A value that is only true or false. | Paid: true |
| Temporal | About time: a date, a time or a duration. | 2026-03-02 |
| Geospatial | About a place on the Earth, such as a map position. | A latitude and longitude |
| Pointer | A value that tells you where other data is stored. | A customer id in an order row |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can name the main data types, say what each holds, and pick the right one for a field.
Starter: what you already know
Have a go
Starter: what you already know
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Numbers, money and time
| Group | Types | Example |
|---|---|---|
| Numeric | Integer | 14 pupils |
| Numeric | Decimal: float or double | 2.5 kilometres |
| Financial | Currency | 12.50 pounds |
| Temporal | Date | 2026-03-02 |
| Temporal | Time | 10:15 |
| Temporal | Duration | 45 minutes |
The cells students fill in are left blank in this preview.
Words, places, media and more
| Group | Types | Example |
|---|---|---|
| Text | Single or many characters, words, paragraphs | Y, Sam, a long review |
| Geospatial | Location | Latitude and longitude of a shop |
| Media | Image, audio, video | A product photo |
| Logical | Boolean | Is it paid: true or false |
| Reference | Pointer to other data | A customer id that points to a customer row |
The cells students fill in are left blank in this preview.
Try it: ask DuckDB for each type
select typeof(14) as whole,
typeof(2.5::float) as small_decimal,
typeof(2.5::double) as big_decimal,
typeof(12.50::decimal(8,2)) as money,
typeof(date '2026-03-02') as a_date,
typeof(time '10:15:00') as a_time,
typeof(interval 45 minute) as a_duration,
typeof(true) as yes_no;
-- Try it: add typeof('Sam') to the list.A common mistake
Warning
Many people store a phone number or a postcode as a number. Nobody adds phone numbers. A leading zero would vanish. If you never calculate with it, store it as text.