Cover lesson · Computer Science · Year 9 · Intermediate

Structuring a database

DCF: Data and computational thinking → Problem-solving and modelling

Name: Class: Date:

Cover teacher — you need no subject knowledge and no computers

Print: this sheet one per pupil, and the stimulus sheet "The school device loan list" one per pair. The stimulus carries the messy data and the list of data types, so pupils do not need to remember any.

Run: 5 min read the messy sheet · 10 min list the four problems it causes · 20 min design the tables, fields, data types and keys · 10 min draw the relationships and write two sample rows · 5 min answer the three "can your design answer this?" questions.

Collect: this sheet. The worked example sheet gives a complete correct design, including every data type, so you can mark against it directly.

What you are doing

The school keeps every Chromebook loan in one enormous spreadsheet, and it has stopped working. You are going to redesign it as a proper relational database: split the one sheet into separate tables, give every field a sensible name and data type, choose a primary key for each table, and link the tables together so no fact is ever stored twice.

Step by step

  1. 5 min — Read the messy sheet and the office's three complaints on the stimulus sheet.
  2. 10 min — List four problems the single-sheet design causes. Quote a row number for each.
  3. 20 min — Design your tables. Minimum three. Every field needs a name and a data type, and every table needs a primary key.
  4. 10 min — Draw the relationships between your tables, then write two real rows of data taken from the messy sheet.
  5. 5 min — Answer the three questions about what your design can and cannot do.

What goes wrong with one big sheet

Four problems, each with a row number from the stimulus sheet as evidence.

No.The problemEvidence (row)
1
2
3
4

Design rules you must follow

Your table designs

Table 1 — name: _______________________

Field nameData typeKey? (PK / FK / none) and why

Table 2 — name: _______________________

Field nameData typeKey? (PK / FK / none) and why

Table 3 — name: _______________________

Field nameData typeKey? (PK / FK / none) and why

Your relationship diagram

Draw a box for each table, then a line between boxes that are linked. Write 1 at the "one" end and N at the "many" end, and name the relationship in words, for example "one pupil has many loans".

Two real rows

Take rows 1 and 4 from the messy sheet and write them out as they would appear in your tables. Note how much of the text disappears once the repeated facts live somewhere else.

Can your design answer this?

Question the office will askWhich tables and fields would you need?
1. Which devices are overdue right now?
2. What is the total replacement value of everything currently out on loan?
3. Seren Bowen has moved from 9C to 9D. How many places in your database have to change?

Success criteria

If you finish early