8
Creating a Schema John Wright

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

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 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

Creating a Schema

John Wright

Page 2: 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

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.).

Page 3: 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

The ERD

PublisherBook

Patron

Purchase Order

CheckOut

Publishes

Contains

SubmittedAuthor

OrderItem

AssociativeEntity

AuthorBook

Contains

AssociativeEntity

Page 4: 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

Schema with AttributesBook

Copy #ISBN Purchase Date AuthorIDTitle PublisherID Type

NameAuthorID

Author

Purchase Order

PublisherIDPONumber Date

Order Item

PONumberLineNumber CostTitle Type

Author Book

AuthorIDISBN

Page 5: 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

EntitiesPublisher

AddressPublisherID RepresentativeIDCity State zip

CheckOut

PatronIDISBN CKOutDate

Patron

AddressPatronID FinesDueCity State zip

Page 6: 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

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.

Page 7: 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

Foreign KeysBook

Copy #ISBN Purchase Date AuthorIDTitle Publisher Type

NameAuthorID

Author

Purchase Order

PublisherIDPONumber Date

Order Item

PONumberLineNumber CostTitle Type

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

Page 8: 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

Foreign Keys

Publisher

AddressPublisherID RepresentativeIDCity State zip

CheckOut

PatronIDISBN CKOutDate

Patron

AddressPatronID FinesDueCity State zip

ISBN and PatronID are both foreign keys as well as composit keys