26. But a customer can check out
more than one book at a time!
27. So instead of creating a bridge
table between customer and
book tables we will create a
check out table to show each
time a customer checks out
books.
28. So we need a table to show
each time a customer checks
out books…
29. …and another table to show
exactly what books that
customer checked out that
day
30. The Checkout_Book table
would be the bridge or
junction table here for the
Book and Checkout tables
many to many relationship.
The first 3 questions are asked from the book table looking at the customer table. Here the answer is yes. You could have a new book for example.
Yes to this question.
Again yes to this question.
this side of the relationship is many and now we have to see what the other side of the relationship is.
The next 3 questions are asked from the customer table looking at the book table. Here the answer is yes.
Again yes!
And yes again.
Since a book could be checked out by more than one customer.
If this database only had 3 tables then there would have to be another entry for each book each customer checked out. We can do better than that!
So instead of a bridge table we will create a checkout table and bring the customer primary key over as the foreign key and also include a Date_Checked_Out field. To reduce errors and to save time we will have Access enter a default time of today for this field.What would be a good primary key for this table?
This is a bridge or junction table so we need both primary keys of the 2 tables in the many to many relationship to serve as foreign keys and here they both can be the primary key. We can never use just one of these two foreign keys as the primary key. And sometimes there are good reasons not to use both foreign keys as the primary key. But here we can totally eliminate errors like accidently entering the same book two times by using both foreign keys as the primary key.