ER-to-Relational Mapping• Mapping from ER to Relational – Map each entity to a table–Map each attribute to a column 1–Map each attribute to a column – Map relationships• Map many-to-many relationships to a table • Use key propagation for one-to-one and one-to-many relationships• If relationship has attributes then map it a table ER-to-Relational Mapping (Cont.)• Mapping keys• For strong entities use the key as the key for the corresponding table2the corresponding table• For weak entities use the combination of the entity’s key and the key from the strong entity• Use the keys from the two entity types as the key for the relationship (table)EER Mapping• Mapping high degree relationship type• Mapping generalization and specialization First alternative:Create one table for S(s1, s2, s3)S3Create one table for A(s1, a)Create one table for B(s1, b) Second alternative:Create one table for A(s1, s2, s3,a)Create one table for B(s1, s2,s3,b)A Bbas1s2s3EER Modeling Mapping disjoint and overlappinggeneralization and specialization Third alternative: Create one table If Disjoint:S4C(s1, s2,s3, a, b)Note: s3 is the qualifying attribute If Overlapping:C(S1, s2, s3, aflag, a, bflag, b)When aflag true then take value of aWhen bflag true then take value of bA Bbas1s2s3EER Modeling• For total participation– At least one of the flag must be true– Why?•For non-total participation5•For non-total participation– For non-total participation one or both flags may be false– Why?• The last approach would work for both disjoint and overlapping generalization and specialization• That is an over-kill for disjoint since the qualifying attribute plays the same roleEER Mapping• Mapping of Shared Subclass– 9.2.2 (pp297)•Mapping of Categories6•Mapping of Categories– 9.2.3
View Full Document