IB Computer Science · A3 · Databases
A3.1 Database fundamentals
Describe what a database is, explain the role of a DBMS, compare flat file and relational databases, and identify common data types.
1/5A database stores organised data for many uses
Part 1 of 5: A database stores organised data for many uses
Think of a school office that keeps student details, timetables and library loans. Holding them in one organised place makes them easy to find and update. A database is an organised collection of related data held electronically.
Data in a database sits in tables. Each row is a record, which covers one item such as one student. Each column is a field, which holds one kind of fact such as a surname.
Databases are everywhere. A bank keeps accounts, a shop keeps stock and orders, and a hospital keeps patient records. A website keeps login details for every user.
Key terms · tap one for its definition
database
A database is an organised collection of related data held electronically so that it can be retrieved, updated and managed efficiently.
record
A record is one row of a table, holding all the fields for a single item.
field
A field is one column of a table, holding a single kind of fact about every record.
Part 2 of 5: A DBMS controls how users reach the data
Now imagine many staff using those records at once. Something must control who sees what and stop edits from clashing. A database management system (DBMS) is the software that does this job.
Programs and people send requests to the DBMS, which carries them out. It has four main tasks.
- storing and retrieving data when users ask for it
- controlling access through accounts and permissions
- keeping data consistent when several users edit together
- backing up data and recovering it after a failure
Together these tasks protect data integrity, which means the data stays accurate and consistent.
Key terms · tap one for its definition
database management system
A database management system is software that creates databases and controls how users and programs store, retrieve and change their data.
data integrity
Data integrity is the accuracy, consistency and validity of data throughout its life in a database.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: A · Worked explanation
Part 3 of 5: A flat file keeps all its data in one table
Before linking tables, consider the simplest design. A flat file database holds all its data in a single table. A teacher’s spreadsheet of students and their subjects is a typical example.
A flat file with one row for each student and subject
- Student
- Ana
- Address
- 12 Oak Road
- Subject
- Maths
- Student
- Ana
- Address
- 12 Oak Road
- Subject
- Physics
- Student
- Ana
- Address
- 12 Oak Road
- Subject
- Art
- Student
- Ben
- Address
- 9 Hill Lane
- Subject
- Maths
Ana’s address is stored three times. This data redundancy wastes space. It also risks inconsistency, because correcting one row and missing another leaves two different addresses.
Flat files work well for small, simple lists. They become awkward as the data grows and more users share it. Each extra subject adds another row of repeated details.
Key terms · tap one for its definition
flat file
A flat file is a database held in a single table, with no links to other tables.
data redundancy
Data redundancy is the unnecessary storage of the same data in more than one place.
Part 4 of 5: Relational databases link tables to avoid repeating data
A relational design solves the repetition by splitting the data. A relational database stores data in several tables that are linked together. Student details go in one table and subjects in another.
The tables are linked through keys. A primary key is a field that identifies each record uniquely, such as a student ID. Another table can store that ID to point back to the right student.
Flat file compared with relational database
- Feature
- Tables
- Flat file
- One
- Relational
- Several, linked
- Feature
- Repeated data
- Flat file
- Common
- Relational
- Minimal
- Feature
- Changing a fact
- Flat file
- Edit every copy
- Relational
- Edit once
- Feature
- Suited to
- Flat file
- Small, simple lists
- Relational
- Large, connected data
Key terms · tap one for its definition
relational database
A relational database is a database that stores data in linked tables and joins them using shared key fields.
primary key
A primary key is a field, or set of fields, whose value identifies each record in a table uniquely.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: C · Worked explanation
Part 5 of 5: Every field has a data type that limits its values
Each field also needs rules about the values it may hold. A data type states what kind of value a field stores. The DBMS uses it to check input and to decide how much space to reserve.
Names vary between systems, but five types are common.
- Integer: whole numbers, such as an age of 16
- Real: numbers with a fractional part, such as a price of 12.50
- Text: letters, digits and symbols, such as a name
- Boolean: true or false, such as whether a book is on loan
- Date: calendar values, such as a date of birth
Key term
data type
A data type is the kind of value a field may hold, which determines its permitted values and storage.
Check your recall[14 marks]
6 written questions. Answer each one in your head or on paper, then open the mark scheme.
- 1.Define[2 marks]
Define the term database.
Show mark schemeHide mark scheme
Model answer
A database is an organised collection of related data. It is stored so that it can be retrieved and updated efficiently.
- 1 mark for stating that it is an organised or structured collection of data
- 1 mark for stating that the data is related and stored so it can be retrieved or updated
- 2.Outline[3 marks]
Outline three tasks carried out by a database management system.
Show mark schemeHide mark scheme
Model answer
A DBMS stores and retrieves data when users ask for it. It controls access using accounts and permissions. It keeps data consistent when several users edit together, and it backs up and recovers data.
- 1 mark for outlining one task such as storing and retrieving data
- 1 mark for outlining a second task such as controlling access
- 1 mark for outlining a third task such as keeping data consistent or backing up and recovering data
- 3.Compare[3 marks]
Compare flat file and relational databases in how they store data that repeats.
Show mark schemeHide mark scheme
Model answer
A flat file keeps all data in one table, so repeated facts such as an address are stored many times. A relational database splits the data into linked tables, so each fact is stored once. Changing a fact therefore needs one edit in a relational database but many in a flat file.
- 1 mark for stating that a flat file repeats data in one table
- 1 mark for stating that a relational database stores each fact once in linked tables
- 1 mark for linking the difference to editing or consistency
- 4.State[1 mark]
State the most suitable data type for a field that records whether a library book is on loan.
Show mark schemeHide mark scheme
Model answer
Boolean.
- 1 mark for stating Boolean
- 5.Explain[2 marks]
Explain why a phone number is stored as text and not as an integer.
Show mark schemeHide mark scheme
Model answer
A phone number can begin with a zero, which an integer would drop. Nobody performs calculations on phone numbers, so a number type gives no benefit.
- 1 mark for stating that an integer would lose a leading zero
- 1 mark for stating that no calculations are done on phone numbers
- 6.Explain[3 marks]
Explain how a DBMS helps to maintain data integrity when several users edit the same records.
Show mark schemeHide mark scheme
Model answer
The DBMS controls who may change the data through accounts and permissions. It keeps the data consistent when edits happen together. It can also restore the data from a backup after a failure, so the data stays accurate.
- 1 mark for stating that access is controlled through permissions
- 1 mark for stating that it keeps data consistent during simultaneous edits
- 1 mark for stating that backup and recovery keep data accurate after a failure

Practice this topic
10 quick-fire multiple-choice questions, easy to hard. Tap an answer to see if you're right and the worked explanation. (The written questions with mark schemes are under “Check your recall” above.)
0 right0 of 10 answered
Includes the 2 quick checks in the note above.
EasyIdentify[1 mark]
Show answer and explanation
Answer: B · Worked explanation
MediumCalculate[2 marks]
Show answer and explanation
Answer: D · Worked explanation
MediumIdentify[1 mark]
Show answer and explanation
Answer: A · Worked explanation
MediumDetermine[1 mark]
Show answer and explanation
Answer: C · Worked explanation
MediumPredict[1 mark]
Show answer and explanation
Answer: B · Worked explanation
HardExplain[2 marks]
Show answer and explanation
Answer: D · Worked explanation
HardDistinguish[2 marks]
Show answer and explanation
Answer: B · Worked explanation
HardDetermine[2 marks]
Show answer and explanation
Answer: C · Worked explanation