Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

AESP task 3: Draw an entity relationship diagram

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

60 minutes

A map of the data

A town map shows streets and how they join. An entity relationship diagram, or ERD, does the same for data. It shows the tables and how they join.

Anybody who reads it knows the shape of the data before they see a single row.

Key words

WordWhat it means
ERDan entity relationship diagram: boxes for tables and lines for the links
Entitya thing the system keeps facts about
Databasean organised collection of data, kept in linked tables
Attributeone fact about an entity, such as a name
Primary keyan attribute whose value is different for every row
Foreign keyan attribute that holds the primary key of another table
Cardinalityhow many of one entity link to the other: one or many
Link tablea table that joins two entities that are many-to-many

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can draw an ERD with entities, keys and relationships, using the right symbols and consistent names.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

This is practice

Important

The real task comes from the exam board. This lesson uses an invented organisation and its own made-up data. Your teacher tells you how the real tasks are set and what you may bring.

Worked example: reading the symbols

SymbolSaysExample
`||`Exactly oneA purchase has exactly one customer
`o{`Zero or manyA customer has zero or many purchases
`|{`One or manyA purchase has one or many lines
`PK`Primary keycustomer_id
`FK`Foreign keycustomer_id inside PURCHASE

The cells students fill in are left blank in this preview.

Many to many needs a link table

A purchase can have many items. An item can be on many purchases. That is many to many, and two tables can not store it on their own.

Add a link table between them. Here it is PURCHASE_LINE. It holds both keys, and one row for each item on each purchase.

The lesson goes on

7 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.