Attributes on Relationships price Price depends bars Sells beers jointly on bar and beer .Create an entity set bars sells beers representing values of the attribute. Note convention: ·Make that entity set arrow participate in the from multiway prices relationship. relationship ="all other entity sets price If price depends only on beers,what should we do? together determine a unique one of these.,” 16
16 Attributes on Relationships bars Sells beers price bars prices sells beers price Price depends jointly on bar and beer Note convention: arrow from multiway relationship = “all other entity sets together determine a unique one of these. ” If price depends only on beers, what should we do? •Create an entity set representing values of the attribute. • Make that entity set participate in the relationship
Converting Multiway to 2 way Creating a new connecting E.S.to represent the rows of a relationship set Many-one relationships from the connecting E.S.to the others 17
17 Converting Multiway to 2 way Creating a new connecting E.S. to represent the rows of a relationship set Many-one relationships from the connecting E.S. to the others
Converting Multiway to 2 way: example Barse Beers Pricese Joe's bare A.B. 5. Joe's bare Bude 4e Mary's bar Bude 3 sells beers Mary's bare A.B. 4 bars prices connecting E price For each relationship (bari,price;,The barThe beer The price beer)in Sells,create: 1.a new entity e in the entity set E 2.add (e;,bar;)to TheBar bars beers prices 3.add (e;,price)to ThePrice 4.add (e;,beer)to TheBeer 18
18 Converting Multiway to 2 way: example bars prices beers sells price bars beers prices connecting E The bar The beer The price For each relationship (bari , pricei , beeri) in Sells, create: 1. a new entity ei in the entity set E 2. add ( ei , bari) to TheBar 3. add ( ei , pricei ) to ThePrice 4. add ( ei , beeri) to TheBeer
Roles Sometimes an E.S.participates more than once in a relationship Label edges with roles to distinguish. Relationship Set Married husband wife Husband Wife Relationship Set Bob Ann Joe Sue Drinkers Buddy1 Buddy2 Bob Ann Joe Sue Ann Bob 1 Buddies 2 Joe Moe 19 000
19 Roles Sometimes an E.S.participates more than once in a relationship. Label edges with roles to distinguish. Drinkers Married husband wife Buddies 1 2 Relationship Set Buddy1 Buddy2 Bob Ann Joe Sue Ann Bob Joe Moe … Relationship Set Husband Wife Bob Ann Joe Sue … …
Subclasses Subclass special case fewer entities more properties ▣Example Ales are a kind of beer.In addition to the properties (attributes and relationships)of beers,there is a "color"attribute for ales. 20
20 Subclasses Subclass = special case = fewer entities = more properties Example Ales are a kind of beer. In addition to the properties (= attributes and relationships) of beers, there is a “color”attribute for ales