entity / relationship diagrams

10
Entity / Relationship Diagrams entities entity sets es are like in ODL. ships: like in ODL except associated with classes (I.e., first class citizen necessarily binary Product address buys

Upload: guenevere-adams

Post on 31-Dec-2015

38 views

Category:

Documents


0 download

DESCRIPTION

Entity / Relationship Diagrams. Objects entities Classes entity sets Attributes are like in ODL. Relationships: like in ODL except - not associated with classes (I.e., first class citizens) - not necessarily binary. Product. address. buys. name. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Entity / Relationship Diagrams

Entity / Relationship Diagrams

Objects entitiesClasses entity sets

Attributes are like in ODL.

Relationships: like in ODL except

- not associated with classes (I.e., first class citizens)

- not necessarily binary

Product

address

buys

Page 2: Entity / Relationship Diagrams

address name ssn

Person

buys

makes

employs

CompanyProduct

name category

stockprice

name

price

Page 3: Entity / Relationship Diagrams

Multi-way Relationships

Purchase

How do we model a purchase relationship between buyers,products and stores?

Product

Person

Store

Page 4: Entity / Relationship Diagrams

Roles in Relationships

Purchase

What if we need an entity set twice in one relationship?

Product

Person

Store

salesperson buyer

Page 5: Entity / Relationship Diagrams

Roles in Relationships

Purchase

Product

Person

Store

salesperson buyer

Note the multiplicity of the relationships: we cannot express all possibilities

Page 6: Entity / Relationship Diagrams

Attributes on Relationships

Purchase

Product

Person

Store

date

Page 7: Entity / Relationship Diagrams

Design Principles

PurchaseProduct Person

What’s wrong?

President PersonCountry

Moral: be faithful!

Page 8: Entity / Relationship Diagrams

What’s Wrong?

Purchase

Product

Store

date

personpersonAddr

Moral: don’t talk too much.

Page 9: Entity / Relationship Diagrams

What’s Wrong?

Purchase

Product

Person

Store

dateDates

Moral: don’t complicate life more than it already is.

Page 10: Entity / Relationship Diagrams

Do we really need 3-way relationships?

Purchase

Person

Store

Product

StoreOf

ProductOf

BuyerOf

Moral: Find a nice way to say things.