Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Access Database Library Assignment


Published on

This presentation walks through some database theory on how to build a database for a library.

Published in: Education
  • Be the first to comment

Access Database Library Assignment

  1. 1. Library Assignment
  2. 2. Lets try to understand onesimple database
  3. 3. A library allows customersto check out books
  4. 4. So what tables do we need?
  5. 5. Customer table: any data thelibrary needs to keep about itscustomers
  6. 6. Customer table primary key:Autonumber
  7. 7. Book table: store any data thelibrary needs to keep about itsbooks
  8. 8. Primary key for book table
  9. 9. Is there a relationshipbetween the book andcustomer table?
  10. 10. To see if 2 tables have arelationship you must ask 3questions.
  11. 11. You have to ask 3 questionsfor each side of therelationship
  12. 12. Could you have a book in thebook table that no one haschecked out?
  13. 13. Could you have a book that 1customer has checked out?
  14. 14. Could you have a book thatmore than 1 customer haschecked out?
  15. 15. Since you can have a bookchecked out by more thanone customer M Book Customer
  16. 16. Could you have a customerin the customer table thathas not checked out a book?
  17. 17. Could you have a customerthat has checked out 1 book?
  18. 18. Could you have a customerthat has checked out morethan 1 book?
  19. 19. This side of the relationship isalso many! M Book Customer
  20. 20. So we have a many to manyrelationship! M M Book Customer
  21. 21. Each customer can check outmore than one book and eachbook can be checked out bymore than one customer
  22. 22. We can’t track which book acustomer checks out withoutadding a new table.
  23. 23. To create a bridge table youstart with the primary keys ofthe related tables
  24. 24. What should be the primarykey for the bridge table?
  25. 25. Entity relationship diagramshows the relationship 1 M M 1customer checkout book
  26. 26. But a customer can check outmore than one book at a time!
  27. 27. So instead of creating a bridgetable between customer andbook tables we will create acheck out table to show eachtime a customer checks outbooks.
  28. 28. So we need a table to showeach time a customer checksout books…
  29. 29. …and another table to showexactly what books thatcustomer checked out thatday
  30. 30. The Checkout_Book tablewould be the bridge orjunction table here for theBook and Checkout tablesmany to many relationship.
  31. 31. To enter data in thisdatabase
  32. 32. You could not enter data about acustomer checking out a book if…
  33. 33. Questions?