Creating a Schema John Wright
Where to Start We start with the ERD. We create a relation for each entity. We need to determine the attributes for each entity. We normally do this on the ERD, but for this exercise I will do it in the SCHEMA We then apply the rules of dependancy to normalize the relations. We then apply determine the primary/foreign key relationships. (See the other slide presentation for help in this.).
The ERD Publisher Book Patron Purchase Order CheckOut Publishes Contains Submitted Author Order Item Associative Entity AuthorBook Contains Associative Entity
Schema with Attributes Book Copy #ISBNPurchase DateAuthorIDTitlePublisherIDTypeNameAuthorID Author Purchase Order PublisherIDPONumberDate Order Item PONumberLineNumberCostTitleType Author Book AuthorIDISBN
Entities Publisher AddressPublisherIDRepresentativeIDCityStatezip CheckOut PatronIDISBNCKOutDate Patron AddressPatronIDFinesDueCityStatezip
Normalization Normally we normalize at this point. See the presentation on normalization. Normalization is determined by dependancies. Next, we add foreign keys using the rules found in the Schema presentation.
Foreign Keys Book Copy #ISBNPurchase DateAuthorIDTitlePublisherTypeNameAuthorID Author Purchase Order PublisherIDPONumberDate Order Item PONumberLineNumberCostTitleType Author Book AuthorIDISBN ISBN and AUTHORID are both foreign keys and composite keys PONumber is a foreign key as well as a composite key PublisherID is a foreign key to publisher table
Foreign Keys Publisher AddressPublisherIDRepresentativeIDCityStatezip CheckOut PatronIDISBNCKOutDate Patron AddressPatronIDFinesDueCityStatezip ISBN and PatronID are both foreign keys as well as composit keys