Relationships between tables
Answers are for parents and teachers.
1
Name the relationship: (a) a pupil and his locker, (b) a class and its pupils, (c) pupils and the clubs they join.
(a) one to one; (b) one to many; (c) many to many.
2
In the teams and players tables of this week, list the players of team 1 and give their number.
Sara, Ali and Adam: three players.
3
A joining table has the pairs (1,1), (1,2), (2,1) and (1,2). Which row breaks the rules, and why?
The fourth row (1,2): the same pair appears twice, which the composite key forbids.
4
A classmate says: “A many-to-many relation cannot be stored in a database.” Explain what is wrong with this sentence.
It can be stored by adding a joining table, which turns it into two one-to-many links.
5
Which field holds the foreign key in a table of books where each book has one writer from a writers table?
A field writer_id in the books table; it holds the primary key of the writers table.