aımnova
DashboardMy LearningCrash CoursesStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Crash Courses
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Teachers
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aımnova

IB study, practice and feedback built around the real exam.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.c1e448f

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer Science HLTopic 3.2Data types
Back to Computer Science HL Topics
3.2.34 min read

Data types (Computer Science HL)

IB Computer Science · Unit 3

Smart study tools

Turn reading into results

Move beyond passive notes. Answer exam-style questions, get AI feedback, and build the skills that earn top marks.

Get Started Free

Contents

  1. 1Every column declares what it holds
  2. 2The common types
  3. 3What the wrong type costs
  4. 4Exam-style question
The big idea: A column's data type says what kind of value may be stored in it.

It is not a suggestion: the database refuses anything that does not fit, which is the first line of defence against bad data.
It decides more than storage: The type also decides what you can do with the values.

You can add numbers and sort dates in real order. Do the same to text and you get nonsense — "10" sorts before "9".

Free preview

This is the free notes preview

You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:

  • FlashcardsLock in vocabulary and key terms with spaced repetition.
  • Practice questionsAnswer exam-style questions and get instant AI marking.
  • Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
  • Personalised study planA daily plan built around your exam date and weak areas.
Start Studying Free Full access to Aimnova Pro · cancel anytime

Numbers

  • Integer — whole numbers: a quantity, an ID, a year
  • Decimal — exact fractions: money, measurements
  • Float — approximate fractions, for scientific values
  • Never use float for money; small rounding errors accumulate

Text

  • Char — fixed length, padded: a two-letter country code
  • Varchar — variable length up to a limit: a name, an address
  • Text — long free text, with no practical limit
  • Varchar is the usual choice for anything human-written

Everything else

  • Date and DateTime — real dates, sortable and subtractable
  • Boolean — true or false, for a yes-or-no fact
  • Currency where the system offers it, for exact money
  • Each exists because the alternative is storing it as text
The test for choosing: Ask: will I 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, a postcode — text is correct, even though it looks like a number.

Feeling unprepared for exams?

Get a clear study plan, practice with real questions, and know exactly where you stand before exam day. No more guessing.

Get Exam Ready FreeYour first topic is free to keep • No credit card required
1

A date stored as text

Sorting puts 01/12/2026 before 02/01/2025, because it compares character by character.

You also cannot ask for "everything in the last 30 days", and nothing stops someone typing 31/02/2026.

2

A number stored as text

"10" sorts before "9", and totals cannot be calculated without converting every value first.

Nothing stops a typo like "12O" with a letter O, which then breaks every calculation that touches it.

3

A phone number stored as a number

The leading zero disappears, because 07700 is the number 7700.

This is the classic case where something that looks numeric must be stored as text — you never do arithmetic on it.

4

Money stored as float

Floats are approximate, so a long series of additions drifts by fractions of a penny.

Use decimal, which stores the exact value, whenever the total has to balance.

Consistency across tables: A foreign key must be the same type as the primary key it points at.

If StudentID is an integer in one table and text in another, joining them either fails or silently returns nothing.

How this is tested — you must name the type AND the specific problem the wrong choice would cause. It comes up two ways:

Paper 1 Section A

  • Outline or choose data types for given columns, 2-4 marks
  • State the effect of a wrong choice
  • Explain why type consistency matters

Paper 1 Section B — case study

  • Choose types for the case study's tables
  • Identify a poor choice in a given design
The classic trap: Choosing a number type because the values look like digits. A phone number, a postcode and a product code are all text — the test is whether you would ever calculate with them.
IB-style questionOutline[4 marks]

A clinic stores: patient ID, date of birth, phone number and consultation fee. Outline a suitable data type for each, with a reason.

Model answer plan

See the answer broken into clear points, with guidance on how each point earns marks.

Claim your free topic

Try an IB Exam Question — Free AI Feedback

Test yourself on Data types. Write your answer and get instant AI feedback — just like a real IB examiner.

what is meant by a null value. [2 marks]

Related Computer Science HL Topics

Continue learning with these related topics from the same unit:

3.1.1Relational databases3.2.1Database schemas3.2.2ERDs3.2.4Building tables
View all Computer Science HL topics
Improve your exam techniqueCommand terms, paper structure, and mark-scheme tips for Computer Science HL
Previous3.2.2ERDsNextBuilding tables3.2.4

23 questions to test your understanding

Reading is just the start. Students who tested themselves scored 82% on average — try IB-style questions with AI feedback.

Start FreeView All Computer Science HL Topics