Practice Flashcards
Flip to reveal answersWhat does a column's data type do?
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.
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.
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.
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.
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.
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.
Read the notes
Full study notes for Data types
Topic 3.2 hub
Database design
More from Topic 3.2
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
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