Back to Topic 3.2 — Database design
3.2.3Computer Science SL5 flashcards

Data types

Practice Flashcards

Flip to reveal answers
Card 1 of 53.2.3
3.2.3
Question

What does a column's data type do?

Click to reveal answer

Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.

All 5 Flashcards — Data types

Sign up free to track progress and get spaced-repetition review schedules.

Card 1definition

Question

What does a column's data type do?

Answer

It says what kind of value may be stored, and the database refuses anything that does not fit. It also decides what can be done with the values — arithmetic on numbers, true ordering on dates.

Card 2process

Question

How do you decide a column's data type?

Answer

Ask whether you will ever calculate with it, compare it, or sort it. If yes it needs a real type; if it is only ever displayed — a phone number or postcode — text is correct however numeric it looks.

Card 3example

Question

Why store a phone number as text rather than a number?

Answer

A numeric type drops the leading zero, so 07700 becomes 7700, and no arithmetic is ever done on a phone number anyway.

Card 4concept

Question

What three things go wrong if a date is stored as text?

Answer

Sorting compares character by character so the order is wrong; date ranges and age calculations become impossible; and nothing rejects an impossible date such as 31/02/2026.

Card 5concept

Question

Why must a foreign key have the same data type as the primary key it references?

Answer

Otherwise the join either fails or silently returns nothing — values that look equal to a person are not equal to the database when their types differ.

Track your progress with spaced repetition

Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.

Start Free
IB Computer Science Data types Flashcards | 3.2.3 | Aimnova