Is 007 a number?
A school shop keeps a list of its products. One box holds a price. Another holds a barcode that starts with zeros, like 007.
If the barcode is saved as a number, the zeros vanish and 007 becomes 7. The shop can no longer find the product. Choosing the right format for each box matters.
Key words
| Word | What it means | Example |
|---|---|---|
| Data format | the kind of value a field holds, which decides what you can do with it | |
| Field | one box in a record, such as a price or a name | |
| Integer | a whole number with no decimal point | 42 |
| Decimal | a number with a decimal point | 2.50 |
| Text | letters, digits and symbols treated as words | Cheese roll |
| Boolean | a value that is only true or false | |
| Date/time | a day, a clock time, or both | 2026-09-07 |
| Currency | an amount of money in one kind of money, such as pounds | |
| Blob | a binary large object: a file such as a picture, saved as raw bytes | |
| Database | an organised store of records that you can ask questions |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can name the seven data formats, say when each is used, and pick the right one for a field.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
The seven formats
| Format | Holds | Example | Use it for |
|---|---|---|---|
| Integer | Whole numbers | 30 | Stock count, age, quantity |
| Decimal | Numbers with a point | 4.75 | Weight, temperature, average |
| Text | Words and symbols | Cola | Names, codes, phone numbers |
| Boolean | True or false | true | In stock, has paid, is a member |
| Date/time | A day and a time | 2026-09-07 12:30 | When a sale happened |
| Currency | Money | 2.50 pounds | Prices, fees, totals |
| Blob | A file as bytes | a photo | Pictures, scans, audio |
The cells students fill in are left blank in this preview.
How to choose
Ask what you will do with the value. If you will add it up, use a number. If you will only read it, use text.
A phone number or a barcode is text, even though it is made of digits. You never add two phone numbers, and a leading zero must stay.
Money needs care
A decimal can be a tiny bit wrong, because computers store it in binary. Adding 0.10 and 0.20 can give 0.30000000000000004.
So data work often saves money as whole pence: 2.50 pounds is stored as the integer 250. Divide by 100 only when you show it.
Try it: ask SQL for the format
SELECT typeof(42) AS whole,
typeof(3.5) AS with_point,
typeof('Cola') AS words,
typeof(X'48') AS raw_bytes,
typeof(price_pence) AS pence
FROM products LIMIT 1;
-- SQLite has no true date or Boolean format.
-- Dates are saved as text like 2026-09-07.
-- Booleans are saved as the integers 1 and 0.
Check: pick the format
Have a go
Check: pick the format
4 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.