How many clubs can one pupil join?
One form has many pupils. One pupil has one locker. A pupil can join many clubs, and a club has many pupils.
These three sentences are three different kinds of link. Each kind is stored in its own way.
Key words
| Word | What it means |
|---|---|
| Relationship | a link between two entities |
| Cardinality | how many records on one side link to records on the other side |
| One-to-one | one record links to exactly one record, written 1:1 |
| One-to-many | one record links to many records, written 1:M |
| Many-to-many | many records link to many records, written M:M |
| Link table | an extra table that turns a many-to-many link into two one-to-many links |
| Crow's foot | the three-pronged mark at the end of a line that means many |
| Primary key | the field that gives every record its own unique id |
| Foreign key | a field that holds the primary key of a record in another table |
| Database | an organised store of tables that you can ask questions |
| SQL | the language used to ask a database for data |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can name the three kinds of relationship, show them with crow's foot lines, and say how each is stored.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
The three kinds of relationship
| Kind | Example | Drawn as | Stored by |
|---|---|---|---|
| One-to-one (1:1) | A pupil and a locker | A plain line | A foreign key, unique, on either table |
| One-to-many (1:M) | A form and its pupils | A crow's foot at the many end | A foreign key on the many side |
| Many-to-many (M:M) | Pupils and clubs | A crow's foot at both ends | A link table with a composite key |
The cells students fill in are left blank in this preview.
Read the lines
Have a go
Read the lines
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.