• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Access Database Library Assignment
 

Access Database Library Assignment

on

  • 1,913 views

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

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

Statistics

Views

Total Views
1,913
Views on SlideShare
1,905
Embed Views
8

Actions

Likes
0
Downloads
40
Comments
0

1 Embed 8

http://isditgs.wikispaces.com 8

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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.

Access Database Library Assignment Access Database Library Assignment Presentation Transcript

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