ER to Relational Mapping Mapping from ER to Relational Map each entity to a table Map each attribute to a column 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 table the 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 1 2 EER Mapping Mapping high degree relationship type Mapping generalization and specialization S s1 s2 s3 cid 1 First alternative Create one table for S s1 s2 s3 Create one table for A s1 a Create one table for B s1 b cid 1 Second alternative Create one table for A s1 s2 s3 a Create one table for B s1 s2 s3 b A a A a B b B b EER Modeling cid 1 Mapping disjoint and overlapping generalization and specialization S s1 s2 s3 cid 1 Third alternative Create one table cid 1 If Disjoint C s1 s2 s3 a b Note s3 is the qualifying attribute cid 1 If Overlapping C S1 s2 s3 aflag a bflag b When aflag true then take value of a When bflag true then take value of b 3 4 EER Modeling For total participation At least one of the flag must be true Why For non total participation 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 role EER Mapping Mapping of Shared Subclass 9 2 2 pp297 Mapping of Categories Mapping of Categories 9 2 3 pp297 298 5 6
View Full Document