120 likes | 254 Views
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.
E N D
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 category name price makes Company Product stockprice buys employs Person name ssn address
Multi-way Relationships How do we model a purchase relationship between buyers, products and stores? Product Purchase Store Person
Roles in Relationships What if we need an entity set twice in one relationship? Product Purchase Store buyer salesperson Person
Roles in Relationships Note the multiplicity of the relationships: we cannot express all possibilities Product Purchase Store buyer salesperson Person
Attributes on Relationships date Product Purchase Store Person
Design Principles What’s wrong? Purchase Product Person President Country Person Moral: be faithful!
What’s Wrong? date Product Purchase Store Moral: don’t talk too much. personAddr person
What’s Wrong? date Dates Product Purchase Store Moral: don’t complicate life more than it already is. Person
Do we really need 3-way relationships? ProductOf Product Purchase StoreOf Store Moral: Find a nice way to say things. BuyerOf Person