Skip to the page
Year 11 · ICT · Autumn 2 · Paper 2 practice: documents, databases, presentations

Databases under time

Exam practicePresent ▶

What this lesson covers

18.1 Create a database structure

Cambridge IGCSE ICT 0417 · Topic 18: Databases · Paper 2

18.2 Manipulate data: calculations, sorting and queries

Cambridge IGCSE ICT 0417 · Topic 18: Databases · Paper 2

18.3 Present data: reports

Cambridge IGCSE ICT 0417 · Topic 18: Databases · Paper 2

You will learn to

  • Import a .csv file into a database and set the correct field type for each field.
  • Create queries with two or more criteria, calculated fields, sorting and wildcards.
  • Produce a report with only the fields asked for, in the order asked for, with titles and formatted numbers.
  • Use the mark scheme to mark your database task and log the lost marks.

Success criteria

  • I can show evidence of every field type and every query design.
  • I can write a two-criteria query that returns the right records.
  • I can produce a report where every field and label is fully visible.
The syllabus points for these sections
  • Import a .csv or .txt file and keep the field names from the first row.
  • Choose the right field type and sub-type for each field.
  • Set display formats for dates, currency, decimals and Boolean fields.
  • Set primary and foreign keys and build a one-to-many relationship.
  • Compare flat-file and relational databases.
  • Design a clear data entry form with suitable controls.
  • Create calculated fields in queries and calculated controls in reports and forms.
  • Use sum, average, maximum, minimum and count.
  • Sort on one or more fields, ascending or descending.
  • Write query criteria with =, >, <, >=, <=, <> and AND, OR, NOT.
  • Use LIKE with the wildcards * and ?.
  • Give clear evidence of every query you build.
  • Produce a report in tabular or columnar layout.
  • Select only the fields asked for, in the order asked for.
  • Add titles, headers and footers.
  • Right-align numbers and line up decimal points.
  • Format numbers as currency, decimals or percentages, and change labels.

Key words

Say each word, then read what it means. Every one is in the glossary too.

Database
An organised store of data that can be searched, sorted and reported on.
Table
A set of records about one kind of thing, such as members or bookings.
Record
One row of a table: all the data about one item.
Field
One column of a table: one piece of data stored for every record.
Field type
The kind of data a field holds: text, numeric, date/time or Boolean.
Boolean
A field type with only two values, such as Yes/No or True/False.
Display format
How a value looks on screen or paper, without changing the stored value.
Primary key
A field whose value is different for every record, used to identify each one.
Foreign key
A field in one table that holds the primary key of another table, to link them.
One-to-many relationship
A link where one record in a table matches many records in another table.
Flat-file database
A database with only one table.
Relational database
A database with two or more tables linked by keys.
.csv file
A plain-text file where each line is a record and commas separate the fields.
Query
A search that shows only the records that meet given criteria.
Criteria
The conditions a record must meet to appear in a query result.
Wildcard
A symbol in a search pattern: * means any number of characters, ? means exactly one.
Calculated field
A field in a query that is worked out from other fields, not typed in.
Calculated control
A box on a report or form that shows a calculation, such as a total.
Tabular layout
A report layout with records in rows under column headings.
Columnar layout
A report layout that shows one record at a time, with each label beside its value.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

18.1 Create a database structure

Tables, records and fields

A database is an organised store of data that a computer can search and sort.

Data sits in tables. A record is one row: all the data about one thing, such as one member.

A field is one column: one piece of data about every record, such as LastName.

Through this topic we use one example: a sports centre in Madrid. It has a Members table and a Bookings table.

MemberIDFirstNameLastNameCategoryPhoneDiscount
M01LucíaGarcíaJunior612 345 67820%
M02PabloRuizAdult655 210 9870%
M03CarmenLópezSenior699 004 32130%
M04DiegoMartínAdult634 778 1200%
M05SofíaNavarroJunior617 556 04320%
?Why?

Splitting data into fields lets the software search one field at a time. You can ask for every Junior member without reading every row yourself.

Import a .csv or .txt file

In the exam you do not type the data. Cambridge gives you a source file, usually .csv (comma separated values) or .txt.

A .csv file is plain text. Each line is one record. Commas separate the fields.

When you import, tell the software that the first row contains field names. Then the headings become field names, not a record.

During the import you can set each field's type and choose the primary key. Check the result against the source file after importing.

BookingID,MemberID,Activity,BookDate,Hours,Rate,Paid
101,M02,Padel,06/10/2026,1.5,12.00,Yes
102,M01,Swimming,06/10/2026,1,4.50,Yes
103,M04,Tennis,07/10/2026,2,11.00,No
!Watch out

If you forget to tick "first row contains field names", the headings become record 1 and every field gets a name like Field1. The examiner cannot see the field names you were asked to use.

Field types and sub-types

A field type (data type) tells the software what kind of data a field holds. It controls how data is stored, checked and sorted.

Cambridge names four main types: text, numeric, date/time and Boolean. Numeric has sub-types: integer, decimal, currency and percentage.

The table shows each type with a field from our sports centre.

TypeSub-typeWhat it holdsOur fieldExample
TextLetters, symbols, or digits not used for mathsMemberID, LastName, PhoneM04, Martín, 634 778 120
NumericIntegerWhole numbers onlyBookingID103
NumericDecimalNumbers with a fractional partHours1.5
NumericCurrencyMoney, shown with a symbol and 2 decimal placesRate€12.00
NumericPercentageA part of 100, often stored as a decimalDiscount20% (stored as 0.2)
Date/timeA date, a time, or bothBookDate07/10/2026
BooleanOnly two values: Yes/No or True/FalsePaidNo
!Watch out

Phone numbers are text, not numeric. You never add or average them. A numeric field also drops a leading zero or a "+34" and cannot store spaces.

Why the wrong type loses marks

The examiner checks your table design. Each wrong type usually costs a mark.

If Hours is set to integer, the value 1.5 is stored as a whole number. The cost of booking 101 is then wrong too.

If BookDate is text, sorting goes by characters, not by date. "06/11/2026" (6 November) sorts before "10/10/2026" (10 October), because 0 comes before 1.

If Paid is text, someone can type "yes", "Y" or "paid". A Boolean field only allows two values, so searches work every time.

?Why?

The type is a promise about the data. Keeping that promise makes searching, sorting and calculating reliable.

!Watch out

Your screenshot of the table design must show every field name in full and its type. Widen the column before you take the screenshot.

Display formats

A display format changes how a value looks, not the value stored.

Dates can show as 07/10/2026 or 7 October 2026. Currency shows a symbol and 2 decimal places, such as €4.50.

Decimal fields can show a set number of places: Hours as 1.0, 1.5, 2.0. A Boolean field can show as Yes/No or as a check box.

Read the task carefully. If it says "currency in euros with 2 decimal places", both parts are marked.

e.g.Example
Rate stored: 4.5 Display format: currency, euro, 2 decimal places Shown on screen: €4.50 Discount stored: 0.3 Display format: percentage, 0 decimal places Shown on screen: 30%
!Watch out

Formatting to 0 decimal places only hides the decimals. The value 1.5 still shows as 2 on screen, which looks wrong. Choose the places the task asks for.

Primary keys and foreign keys

A primary key is a field that holds a different value for every record. It identifies each record exactly. MemberID is the primary key of Members.

BookingID is the primary key of Bookings. Two bookings can share a member, an activity or a date, but never a BookingID.

A foreign key is a field in one table that is the primary key of another table. MemberID in Bookings is a foreign key. It tells you who made each booking.

BookingIDMemberIDActivityBookDateHoursRatePaid
101M02Padel06/10/20261.5€12.00Yes
102M01Swimming06/10/20261.0€4.50Yes
103M04Tennis07/10/20262.0€11.00No
104M02Swimming08/10/20261.0€4.50Yes
105M03Pilates08/10/20261.0€8.00No
106M05Padel09/10/20261.0€12.00No
107M04Padel10/10/20262.0€12.00Yes
108M01Tennis10/10/20261.0€11.00Yes
!Watch out

A name is a poor primary key. Two members can both be called Lucía García. Use an ID that the system gives out once.

One-to-many relationships

A relationship links two tables through a shared field. Here the link is MemberID.

It is one-to-many: one member can make many bookings, but each booking belongs to one member.

The "one" side is the primary key (Members.MemberID). The "many" side is the foreign key (Bookings.MemberID).

Many programs let you switch on referential integrity. Then you cannot add a booking for a member who does not exist, such as M09.

e.g.Example
M01 (Lucía García) → bookings 102 and 108 M02 (Pablo Ruiz) → bookings 101 and 104 M03 (Carmen López) → booking 105 M04 (Diego Martín) → bookings 103 and 107 M05 (Sofía Navarro) → booking 106

There is a diagram for this step in the IGCSE library.

Flat-file and relational databases

A flat-file database has one table. A relational database has two or more linked tables.

In a flat file, Pablo Ruiz's name and phone would be typed again on every booking he makes.

Repeated data wastes space and causes mistakes. If Pablo changes phone, you must find and change every copy.

Flat-fileRelational
TablesOneTwo or more, linked by keys
Repeated dataA lot (member details on every booking)Little (member details stored once)
UpdatingChange every copy; easy to miss oneChange once in Members
Set upQuick and simpleNeeds keys and relationships planned
Good forSmall, simple listsLarger data with links, like bookings
?Why?

Storing each fact once means it can only be wrong in one place. That keeps the data consistent.

Data entry forms

A data entry form shows one record at a time so a person can type data into a table. Good forms reduce typing errors.

Use radio buttons when the user must pick exactly one of a few options: Category is Junior, Adult or Senior.

Use a check box for a Boolean field: Paid is ticked or not.

Use a drop-down menu for a longer fixed list: Activity is Padel, Pilates, Swimming or Tennis.

Good design: a clear title, fields in a sensible order, one font, readable size, labels lined up, and white space between groups.

e.g.Example
New booking form (top to bottom) Title: New Booking BookingID: [filled in by the system] MemberID: [drop-down of M01–M05] Activity: [drop-down] BookDate: [date box] Hours: [box] Paid: [check box]
!Watch out

Marks are lost for cramped forms, mixed fonts, labels cut off, or fields in a random order. Follow the order the task gives, and check every label is fully visible.

18.2 Manipulate data: calculations, sorting and queries

Calculated fields and calculated controls

A calculated field is a new field in a query, worked out from other fields. It is not typed in and not stored in the table.

A calculated control is a box on a report or form that shows a calculation, such as a total.

In most database software you give the new field a name, a colon, then the formula. Field names go in square brackets.

e.g.Example
Booking 101: Hours 1.5, Rate €12.00 Cost = 1.5 × 12.00 = €18.00 Booking 103: Hours 2, Rate €11.00 Cost = 2 × 11.00 = €22.00 All eight costs: 18.00, 4.50, 22.00, 4.50, 8.00, 12.00, 24.00, 11.00
Calculated field in a query:
Cost: [Hours]*[Rate]

Calculated control in a report footer:
=Sum([Cost])
?Why?

Calculating, not storing, keeps the answer right. If someone corrects the hours, the cost updates by itself.

!Watch out

Spell the field names exactly as in the table. [Hour] instead of [Hours] makes the software ask for a value, and the answer is wrong.

Sum, average, maximum, minimum, count

These five functions summarise many records into one value. You use them in reports (calculated controls) or in queries (a totals row).

Sum adds up. Average adds up and divides by how many. Max finds the biggest. Min finds the smallest. Count counts the records.

FunctionFormula typedResult for all 8 bookings
Sum=Sum([Cost])€104.00
Average=Avg([Cost])€13.00
Maximum=Max([Cost])€24.00
Minimum=Min([Cost])€4.50
Count=Count([BookingID])8
e.g.Example
Sum: 18 + 4.50 + 22 + 4.50 + 8 + 12 + 24 + 11 = 104.00 Average: 104.00 ÷ 8 = 13.00 Max: 24.00 (booking 107) Min: 4.50 (bookings 102 and 104) Count: 8 records
!Watch out

Put a total in the report footer, not the page footer. A page footer total often shows an error or only that page's records.

Sort on one or more fields

Ascending means A to Z, smallest to largest, earliest date to latest. Descending is the reverse.

You can sort on two fields. The first sort field decides the main order. The second only matters when the first field has equal values.

In most query grids the software sorts from left to right. Put the main sort field to the left of the second one.

e.g.Example
Task: sort by Activity ascending, then by Cost descending. Padel 107 €24.00 Padel 101 €18.00 Padel 106 €12.00 Pilates 105 €8.00 Swimming 102 €4.50 Swimming 104 €4.50 Tennis 103 €22.00 Tennis 108 €11.00
?Why?

Within the three Padel bookings, the activity is the same, so the second sort (Cost, largest first) decides their order.

!Watch out

If Cost sits to the left of Activity in the grid, the software sorts by Cost first. The printout is then in the wrong order and loses the mark.

Read a query grid: a simple search

A query asks the database a question and shows only the matching records. Most software gives you a design grid.

Each column is one field. The rows are: Field, Table, Sort, Show, Criteria and Or.

Criteria is the condition a record must meet. Show decides if the field appears in the result.

Task: find all Padel bookings, by date. The software adds quote marks around text, so "Padel" is fine.

FieldBookingIDActivityBookDateCost: [Hours]*[Rate]
TableBookingsBookingsBookings
SortAscending
Show✓✓✓✓
Criteria"Padel"
Or
e.g.Example
Result (3 records): 101 Padel 06/10/2026 €18.00 106 Padel 09/10/2026 €12.00 107 Padel 10/10/2026 €24.00

Comparison operators

Comparison operators compare a field with a value. They work on numbers, currency and dates.

= equal to. > greater than. < less than. >= greater than or equal to. <= less than or equal to. <> not equal to.

For dates, "greater than" means later. Some software puts # signs round a date for you. That is normal.

CriteriaFieldMatching bookings
>10Cost101, 103, 106, 107, 108
<=8Rate102, 104, 105
>=08/10/2026BookDate104, 105, 106, 107, 108
<>"Swimming"Activity101, 103, 105, 106, 107, 108
2Hours103, 107
!Watch out

Watch the difference between > and >=. ">08/10/2026" leaves out bookings 104 and 105, which are on 8 October. Read whether the task says "after" or "on or after".

AND: every condition must be true

AND means a record must meet all the conditions. AND makes the result smaller.

In a query grid, conditions on the same Criteria row are joined with AND.

Task: find Padel bookings that are not paid.

FieldBookingIDActivityPaid
TableBookingsBookingsBookings
Sort
Show✓✓✓
Criteria"Padel"No
Or
e.g.Example
Padel bookings: 101, 106, 107 Of these, Paid = No: only 106 Result: 1 record (106, Padel, No) A range on one field also uses AND: Cost criteria: >=10 And <=20 Result: 101 (€18.00), 106 (€12.00), 108 (€11.00)
?Why?

Cost cannot be both above 20 and below 10, so AND inside one cell gives a range. Some software also accepts Between 10 And 20.

OR: any condition can be true

OR means a record needs to meet at least one condition. OR makes the result bigger.

In a query grid, conditions on different rows (Criteria and Or) are joined with OR. You can also type "Padel" Or "Tennis" in one cell.

Each row is read as a complete condition on its own. This matters when you mix AND with OR.

FieldBookingIDActivityPaid
TableBookingsBookingsBookings
Sort
Show✓✓✓
Criteria"Padel"No
Or"Tennis"No
e.g.Example
Task: unpaid Padel or Tennis bookings. Row 1: Padel AND No → 106 Row 2: Tennis AND No → 103 Result: 103 and 106 Wrong grid: "No" typed only on row 1. Row 1: Padel AND No → 106 Row 2: Tennis (any Paid) → 103, 108 Result: 103, 106, 108. Booking 108 is paid, so this is wrong.
!Watch out

When you mix AND and OR, repeat the shared condition on every row. This is one of the most common lost marks in Paper 2.

NOT, LIKE and wildcards

NOT finds records that do not match. Not "Swimming" gives the same result as <>"Swimming".

LIKE searches for a pattern instead of an exact value. It uses wildcards: symbols that stand for unknown characters.

The `*` wildcard stands for any number of characters, including none. The `?` wildcard stands for exactly one character.

Try it below. The toy uses a different table: a sports centre's bookings. Press the Member LIKE S* example, then type Not in front of Like "S*". Watch the matching and non-matching records swap. Then try Like "?a*".

CriteriaFieldMatchesBookings / members found
Like "P*"ActivityStarts with PPadel and Pilates: 101, 105, 106, 107
Not Like "P*"ActivityDoes not start with PSwimming and Tennis: 102, 103, 104, 108
Like "*ing"ActivityEnds with ingSwimming: 102, 104
Like "?a*"LastNameSecond letter is aGarcía, Martín, Navarro (M01, M04, M05)
?Why?

In "?a*" the ? uses up exactly the first letter, so the a must be second. Ruiz and López fail because their second letters are u and ó.

!Watch out

Some database software uses % and _ instead of * and ?. Cambridge uses * and ?. If you type "P*" without LIKE, many programs search for a real star.

There is something to try for this step in the IGCSE library.

Queries across two tables, and evidence

Because the tables are related, one query can show fields from both. Add both tables to the query; the relationship joins them on MemberID.

Task: show the name, activity and cost of every unpaid booking, with a charge after discount.

Evidence: take a screenshot of the design grid showing all criteria in full, and a screenshot or printout of the result.

FieldFirstNameLastNameActivityPaidCharge: [Hours]*[Rate]*(1-[Discount])
TableMembersMembersBookingsBookings
SortAscending
Show✓✓✓✗✓
CriteriaNo
Or
e.g.Example
Unpaid bookings: 103, 105, 106, sorted by LastName Carmen López, Pilates: 1 × 8.00 × (1 − 0.3) = €5.60 Diego Martín, Tennis: 2 × 11.00 × (1 − 0) = €22.00 Sofía Navarro, Padel: 1 × 12.00 × (1 − 0.2) = €9.60
?Why?

Paid is used to search but is not shown, so Show is unticked. The task decides which fields appear.

!Watch out

Common lost marks: criteria cut off in a narrow column, a typing error such as "Paddel", showing fields the task did not ask for, or no screenshot of the criteria at all. The examiner can only mark what is visible.

18.3 Present data: reports

Reports: tabular or columnar

A report is a formatted printout of data from a table or query. It is made for people to read, not for typing data in.

Tabular layout shows records as rows under column headings, like a table. It fits many records on a page.

Columnar layout shows one record at a time, with each label next to its value, down the page. It suits a record card.

e.g.Example
Tabular BookingID Activity Cost 101 Padel €18.00 103 Tennis €22.00 Columnar BookingID: 101 Activity: Padel Cost: €18.00
?Why?

Pick the layout the task names. If none is named, tabular is usually clearer for a list of records.

Field selection, field order and labels

Base the report on the query that holds the right records. Then add only the fields the task lists.

Put the fields in the exact order the task gives, from left to right.

A label is the text heading above or beside a field. You can change it to plain words, such as "Booking date" instead of BookDate, if the task allows.

Every label and every value must be shown in full. Nothing may be cut off.

!Watch out

Report wizards often shorten labels or squash columns, so "Activity" shows as "Activ". Widen every control and check print preview before printing.

Titles, headers and footers

The report title goes in the report header. It appears once, at the top of page 1.

The page header repeats at the top of every page. It usually holds the column labels.

The page footer repeats at the bottom of every page: page numbers, date. The report footer appears once at the end: totals and averages.

Cambridge often asks for your name, centre number and candidate number in the header or footer. That is how your printout is identified.

e.g.Example
Report header: Padel and Tennis Bookings, October 2026 Page header: BookingID | Booking date | Activity | Hours | Cost Detail: one line per booking Report footer: Total cost, Average cost Page footer: Ana Pérez 12345 0001 | Page 1 of 1
!Watch out

Type the title exactly as given, with the same spelling and capital letters. Extra or missing words lose the mark.

Align numbers and format them

Right-align numbers so the units, tens and hundreds line up. Then values are easy to compare.

Decimal alignment means the decimal points sit in one column. Setting every value to the same number of decimal places does this.

Use the format the task asks for: currency with a symbol, a set number of decimal places, or a percentage.

Left-aligned    Right-aligned, 2 dp
€4.5              €4.50
€22              €22.00
€8                €8.00
€104            €104.00
?Why?

When digits line up, the eye compares numbers by their width. €104.00 clearly looks bigger than €8.00.

!Watch out

A label above a right-aligned number should also be right-aligned. Otherwise the heading looks like it belongs to the next column.

A finished report with calculated controls

This report uses the query for Padel or Tennis bookings, sorted by date ascending. It has a title, labels in full, right-aligned numbers and totals in the report footer.

Hours are shown to 1 decimal place. Cost is currency in euros with 2 decimal places.

BookingIDBooking dateActivityHoursCost
10106/10/2026Padel1.5€18.00
10307/10/2026Tennis2.0€22.00
10609/10/2026Padel1.0€12.00
10710/10/2026Padel2.0€24.00
10810/10/2026Tennis1.0€11.00
Total7.5€87.00
Average€17.40
Number of bookings5
e.g.Example
Total cost: =Sum([Cost]) → 18 + 22 + 12 + 24 + 11 = €87.00 Average: =Avg([Cost]) → 87.00 ÷ 5 = €17.40 Count: =Count([BookingID]) → 5 Total hours: =Sum([Hours]) → 1.5 + 2 + 1 + 2 + 1 = 7.5
?Why?

Each calculated control has a label beside it. A number on its own, such as 87, means nothing to a reader.

How report marks are lost

Most report marks are for small details. Check each one in print preview before you print.

Use landscape orientation if the fields do not fit across a portrait page. The report should be one page wide.

CheckLost mark if…
Right recordsThe query criteria were wrong, so extra or missing rows appear
Right fields, right orderA field is missing, extra, or in the wrong place
Full labels and dataAny heading or value is cut off
Sort orderRecords are not in the order asked for
TitleMissing, misspelt, or not in the report header
Number formatsWrong currency symbol or wrong number of decimal places
AlignmentNumbers are not right-aligned
TotalsA calculated control is missing, wrong, or has no label
IdentificationName, centre number or candidate number missing
!Watch out

Printing the table instead of a report loses most of the report marks. A report needs a title and formatted layout.

Study it

Open the study page and go one step at a time.

The steps for this lesson

Try it

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.