1. Trang chủ
  2. » Tất cả

Topic 1 mapping eer model constructs to relations

59 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Mapping EER Model Constructs to Relations Questions and Exercises Ho Chi Minh City University of Technology ∗∗∗ DATABASE SYSTEM Mapping EER Model Constructs to Relations Group March 2019 Mapping EER Model Constructs to Relations Questions and Exercises Members list Group 1: Đinh Quốc Cường Trần Thanh Quang Trần Đình Tấn Đinh Hồng Kim Võ Quý Giang 1710712 1712802 1713093 1711872 1711130 Mapping EER Model Constructs to Relations Questions and Exercises Overview Mapping EER Model Constructs to Relations Mapping of Specialization or Generalization Mapping of Shared Subclasses (Multiple Inheritance) Mapping of Categories (Union Types) Questions and Exercises Questions Exercise Mapping EER Model Constructs to Relations Mapping EER Model Constructs to Relations Mapping of Specialization or Generalization Mapping of Shared Subclasses (Multiple Inheritance) Mapping of Categories (Union Types) Questions and Exercises Questions Exercise Questions and Exercises Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization • There are several options for mapping a number of subclasses that together form a specialization (or alternatively, that are generalized into a superclass) Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization • There are several options for mapping a number of subclasses that together form a specialization (or alternatively, that are generalized into a superclass) • Two main options: • Map specialization into a single table • Map specialization into multiple tables Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization • There are several options for mapping a number of subclasses that together form a specialization (or alternatively, that are generalized into a superclass) • Two main options: • Map specialization into a single table • Map specialization into multiple tables • We use: • Attrs(R) - the attributes of a relation R • PK(R) - primary key of R Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization Step • Options for Mapping Specialization of Generalization: Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization Step • Options for Mapping Specialization of Generalization: • m subclasses {S1 , S2 , , Sm } Mapping EER Model Constructs to Relations Questions and Exercises Mapping of Specialization or Generalization Step • Options for Mapping Specialization of Generalization: • m subclasses {S1 , S2 , , Sm } • Superclass C, the attributes of C are {k, a1 , a2 , , an } (k is the primary key) Mapping EER Model Constructs to Relations Questions and Exercises Mapping of categories Step • Let C1 , C2 , , Cm be the entity types participating in the union and S be the category • Create a relation to correspond to the category S • Specify a surrogate key ks so that PK(S) = ks Mapping EER Model Constructs to Relations Questions and Exercises Mapping of categories Step • Let C1 , C2 , , Cm be the entity types participating in the union and S be the category • Create a relation to correspond to the category S • Specify a surrogate key ks so that PK(S) = ks • Add ks to each attribute of Ci as a foreign key Mapping EER Model Constructs to Relations Questions and Exercises Mapping of categories Step • Let C1 , C2 , , Cm be the entity types participating in the union and S be the category • Create a relation to correspond to the category S • Specify a surrogate key ks so that PK(S) = ks • Add ks to each attribute of Ci as a foreign key • If all the Ci have the same key, sue that as PK(S) instead Mapping EER Model Constructs to Relations Mapping of categories Questions and Exercises Mapping EER Model Constructs to Relations Mapping EER Model Constructs to Relations Mapping of Specialization or Generalization Mapping of Shared Subclasses (Multiple Inheritance) Mapping of Categories (Union Types) Questions and Exercises Questions Exercise Questions and Exercises Mapping EER Model Constructs to Relations Questions and Exercises Question Discuss the correspondences between the ER model constructs and the relational model constructs Show how each ER model construct can be mapped to the relational model and discuss any alternative mappings Discuss the options for mapping EER model constructs to relations, and the conditions under which each option could be used Mapping EER Model Constructs to Relations Questions and Exercises Question Answer: ER Model Entity type 1:1 or 1:N relationship type M:N relationship type n ary relationship type Simple attributes Composite attributes Multivalued attributes Multivalued attributes Key attribute Relational Model “Entity” relation Foregin key “Relationship” relation and two foreign keys “Relationship” relation and n foreign keys Attributes Set of simple component attributes Relation and foreign key Domain Primary key or secondary key Mapping EER Model Constructs to Relations Questions and Exercises Question We have step to mapping ER model to relation model • Step : Mapping regular Entity types • Step : Mapping of a Week Entity types • Step : Mapping Binary 1:1 relationship types • Step 4: Mapping of Binary 1:N relationship types • Step 5: Mapping of Binary M:N relationship types • Step 6: Mapping multivalued attributes • Step 7: Mapping of N-ary Relationship types Mapping EER Model Constructs to Relations Questions and Exercises Question Discuss the options for mapping EER model constructs to relations, and the conditions under which each option could be used • Multiple relations – superclass and subclasses • Multiple relations – subclasses relations only • Single relation with one type attributes • Single relation with multiple type attributes Mapping EER Model Constructs to Relations Questions and Exercises Exercise Exercise 9.6 (page 304) Map the EER diagrams in Figures 4.9 into relational schemas Justify your choice of mapping options Mapping EER Model Constructs to Relations Questions and Exercises Exercise Figure 4.9 Mapping EER Model Constructs to Relations Questions and Exercises Exercise Solution: Mapping EER Model Constructs to Relations Questions and Exercises Excercise Exercise 9.8 Consider the EER diagram in Figure 9.9 for a car dealer: Map the EER schema into a set of relations For the VEHICLE to CAR/TRUCK/SUV generalization, consider the four options presented in Section 9.2.1 and show the relational schema design under each of those options Mapping EER Model Constructs to Relations Questions and Exercises Exercise Solution: Mapping EER Model Constructs to Relations Questions and Exercises The End

Ngày đăng: 04/04/2023, 08:24

w