Supply teacher deck · Computer Science · Year 9

Structuring a Database

Slide 1 of 7
05:00

Slide 1 of 7 · Settling starter · Computer Science · Year 9

5 minutes

Structuring a database

The school keeps every Chromebook loan in one enormous spreadsheet, device_loans_2025.xlsx, and it has stopped working. It is up to 900 rows. Today you redesign it as a proper relational database.

While the register is called: write your name, class and date on your worksheet, then read the messy sheet and the office’s 3 complaints on the stimulus sheet.

Starter question: Seren Bowen appears in 2 rows. Which form group is she in?

DCF: Data and computational thinking → Problem-solving and modelling No computers needed · you design the structure, you do not fix the data

Slide 2 of 7 · Today’s brief and key words · Computer Science · Year 9

2 minutes

Your brief: split 1 sheet into linked tables

You will list 4 problems the single sheet causes, split it into at least 3 tables, give every field a name and a data type, choose a primary key for each table, link the tables with foreign keys, write 2 real rows, and test your design against 3 questions the office asks.

Primary key (PK)

1 field whose value is different in every row and never changes. A pupil’s name is not a primary key.

Foreign key (FK)

A field holding another table’s primary key. It is how 1 table refers to another.

Data type

The narrowest type that fits: INTEGER, VARCHAR(n), CHAR(n), DATE, DECIMAL(p,s) or BOOLEAN. Dates in DATE, money in DECIMAL.

DCF: Data and computational thinking → Problem-solving and modelling A fact is stored in exactly 1 place

Slide 3 of 7 · Step 2: what goes wrong with 1 big sheet · Computer Science · Year 9

9 minutes

Step 2: list 4 problems, each with a row number as evidence

Use the 10 rows and the 3 complaints on the stimulus sheet. Each problem needs a row number from the messy sheet as evidence.

No. The problem Evidence (row)
1 The same fact is stored many times. “Acer Chromebook 314” and “£215.00” appear in 5 of the 10 rows. Change the price and you have to find every copy. Rows 1, 2, 4, 5 and 10. The office’s third complaint.
Step 2 on your worksheet · 9 minutes Quote a row number for every problem

Slide 4 of 7 · Step 3: design your tables · Computer Science · Year 9

18 minutes

Step 3: design your tables, minimum 3

One table per kind of thing: a pupil is a kind of thing, a loan is a kind of thing, they are not the same thing. Every field needs a name and a data type. Every table needs a primary key. A table refers to another with a foreign key.

Table 1: pupils Data type Key? (PK / FK / none) and why
pupil_id INTEGER PK: a number the school assigns. Unique, and it never changes when a pupil changes name or form.
surname VARCHAR(40) none: long enough for a double-barrelled surname such as Morgan-Hughes.
date_of_birth DATE none: a real date, so the office can sort by it.
Step 3 on your worksheet · 18 minutes If a price appears in 400 rows, it is in the wrong table

Slide 5 of 7 · Steps 4 and 5: relationships, 2 real rows, 3 questions · Computer Science · Year 9

12 minutes

Step 4: draw the relationships and write 2 rows. Step 5: can your design answer this?

Step 4 (8 min): draw a box for each table and a line between linked boxes. Write 1 at the “one” end and N at the “many” end, and name it in words, for example “one pupil has many loans”. Then write rows 1 and 4 of the messy sheet as they would appear in your tables.

Step 5 (4 min): for each of the 3 office questions, say which tables and fields you would need.

Model, row 1 in the new tables: pupils: 1 | Elin | Prys | 9B | 2011-03-12 · devices: 2 | CB-0042 | Acer Chromebook 314 | 215.00 · loans: 1 | pupil_id 1 | device_id 2 | 2025-09-15 | 2025-09-29 | 2025-09-26 | TRUE

Steps 4 and 5 on your worksheet · 12 minutes Notice how much text disappears once repeated facts live elsewhere

Slide 6 of 7 · Self and partner check · Computer Science · Year 9

2 minutes

Check your design against the rules

Tick each success criterion on your sheet that your design meets. Then correct 1 thing: find any date or money field you typed as text and change its data type.

  • I split the data by the kind of thing it describes, so no fact about a pupil, a device or a model is repeated.
  • Every table has a primary key that is unique and will never need to change.
  • Every field has the narrowest sensible data type, with dates as DATE and money as DECIMAL.
  • My tables are joined by foreign keys, and my diagram names each relationship and marks its “one” and “many” ends.
  • I tested my design against real questions the office asks, and said which fields would answer each one.
2 minutes · self and partner check Finished early? Write the rule that stops a device being lent twice at once

Slide 7 of 7 · Plenary review · Computer Science · Year 9

2 minutes

Quick-check answers before handing in

Check your main answers before your worksheets are collected.

Question Correct answer
Which 2 rows show the same device out with 2 pupils at once? Rows 4 and 5: CB-0042, 02/10/2025 to 16/10/2025, Seren Bowen and Rhys Morgan Hughes.
What data type should the due date and the replacement cost have? DATE and DECIMAL(7,2). Text cannot be sorted, subtracted or added up.
Seren Bowen moves from 9C to 9D. How many places change in a good design? 1: the form_group field in her single row of the pupils table.
Check your name and class are on your worksheet Leave stimulus sheets neat on the desk