Database Mapping
39 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the first step in the ER-to-Relational Mapping Algorithm?

  • Mapping of N-ary Relationship Types
  • Mapping of Regular Entity Types (correct)
  • Mapping of Multivalued attributes
  • Mapping of Binary 1:1 Relation Types
  • What is the purpose of Step 1 in the ER-to-Relational Mapping Algorithm?

  • To map multivalued attributes
  • To map weak entity types
  • To create a relation with all the simple attributes of the entity type (correct)
  • To map binary 1:1 relation types
  • What is chosen as the primary key for the relation R in Step 1?

  • One of the key attributes of E (correct)
  • A multivalued attribute of E
  • A composite attribute of E
  • Any simple attribute of E
  • What happens if the chosen key of E is composite in Step 1?

    <p>The set of simple attributes form the primary key</p> Signup and view all the answers

    What is created in Step 2 for each weak entity type W?

    <p>A relation with all the simple attributes of W and foreign key attributes of the owner entity type</p> Signup and view all the answers

    What are included as foreign key attributes of the relation R in Step 2?

    <p>The primary key attribute(s) of the relation(s) corresponding to the owner entity type(s)</p> Signup and view all the answers

    What is the purpose of Steps 8 and 9 in the ER-to-Relational Mapping Algorithm?

    <p>To map specialization or generalization and union types</p> Signup and view all the answers

    What is the result of mapping the COMPANY ER schema into a relational schema?

    <p>The creation of three relations: EMPLOYEE, DEPARTMENT, and PROJECT</p> Signup and view all the answers

    What is the primary key of the DEPENDENT relation?

    <p>{ESSN, DEPENDENT_NAME}</p> Signup and view all the answers

    Which approach is used to map a binary 1:1 relationship type?

    <p>Foreign Key approach</p> Signup and view all the answers

    What is the purpose of Step 2 in mapping ER schema to relational schema?

    <p>Mapping of Weak Entity Types</p> Signup and view all the answers

    What is the primary key of the relation DEPENDENT renamed to?

    <p>ESSN</p> Signup and view all the answers

    Which entity type is chosen to serve in the role of S in a 1:1 relationship type?

    <p>Entity type with total participation</p> Signup and view all the answers

    In a binary 1:N relationship type, where is the foreign key included?

    <p>In the relation S</p> Signup and view all the answers

    What is included as attributes of S in a 1:N relationship type?

    <p>Simple attributes of the 1:N relation type</p> Signup and view all the answers

    What is the result of mapping the COMPANY ER schema?

    <p>A relational schema</p> Signup and view all the answers

    What is the primary key of R in the given ER model?

    <p>{DNUMBER, DLOCATION}</p> Signup and view all the answers

    What is created to represent an n-ary relationship type R, where n>2?

    <p>A new relationship S</p> Signup and view all the answers

    What is included as attributes of S in the mapping of an n-ary relationship type?

    <p>All of the above</p> Signup and view all the answers

    What is the primary key of the relation SUPPLY in the relational schema?

    <p>{SNAME, PARTNO, PROJNAME}</p> Signup and view all the answers

    What corresponds to a 'Relationship' relation in the relational model?

    <p>All of the above</p> Signup and view all the answers

    What is mapped to a set of simple component attributes in the relational model?

    <p>Composite attribute</p> Signup and view all the answers

    What is the mapping for a multivalued attribute in the relational model?

    <p>Relation and foreign key</p> Signup and view all the answers

    What is the next step after mapping an n-ary relationship type?

    <p>Options for Mapping Specialization or Generalization</p> Signup and view all the answers

    What is the primary key of the WORKS_ON relation in the relational database schema?

    <p>The combination of ESSN and PNO</p> Signup and view all the answers

    What is the purpose of including the primary key DNUMBER of the DEPARTMENT relation as a foreign key in the EMPLOYEE relation?

    <p>To represent the M:N relationship type WORKS_FOR</p> Signup and view all the answers

    What is included in the relation S to represent the M:N relationship type R?

    <p>The primary keys of the participating entity types and any simple attributes of the M:N relationship type</p> Signup and view all the answers

    What is the primary key of the relation R created to map a multivalued attribute A?

    <p>The combination of A and K</p> Signup and view all the answers

    Why is the attribute DLOCATION included in the relation DEPT_LOCATIONS?

    <p>To represent the multivalued attribute LOCATIONS of DEPARTMENT</p> Signup and view all the answers

    What is the purpose of creating a new relation S to represent a binary M:N relationship type R?

    <p>To create a relation between the participating entity types</p> Signup and view all the answers

    What is the primary key of the DEPT_LOCATIONS relation?

    <p>The combination of DLOCATION and DNUMBER</p> Signup and view all the answers

    What is the main difference between Options 8A and 8B?

    <p>Option 8A creates a single relation for the superclass, while Option 8B creates a relation for each subclass.</p> Signup and view all the answers

    What is the purpose of creating a relation L in Option 8A?

    <p>To store the attributes of the superclass.</p> Signup and view all the answers

    What is common in the attributes of relations Li in Options 8A and 8B?

    <p>They all have the attribute k.</p> Signup and view all the answers

    What is the limitation of using Option 8B?

    <p>It can only be used for total specialization.</p> Signup and view all the answers

    What is the advantage of using Option 8C?

    <p>It requires less relations to be created.</p> Signup and view all the answers

    What is the purpose of the attribute t in Option 8C?

    <p>To store the type of the entity.</p> Signup and view all the answers

    Which option is suitable for mapping partial specialization?

    <p>Option 8A</p> Signup and view all the answers

    What is the primary key of the relation L in Option 8C?

    <p>{k}</p> Signup and view all the answers

    Study Notes

    ER-to-Relational Mapping Algorithm

    • The algorithm consists of 9 steps to map ER diagrams to relational schemas
    • Steps 1-7 map ER model constructs to relations
    • Steps 8-9 map EER model constructs to relations

    Step 1: Mapping of Regular Entity Types

    • For each regular entity type E, create a relation R with all simple attributes of E
    • Choose a key attribute of E as the primary key for R
    • If the chosen key is composite, the set of simple attributes that form it will together form the primary key of R

    Step 2: Mapping of Weak Entity Types

    • For each weak entity type W, create a relation R with all simple attributes of W
    • Include the primary key attribute(s) of the owner entity type(s) as foreign key attributes of R
    • The primary key of R is the combination of the primary key(s) of the owner(s) and the partial key of W, if any

    Step 3: Mapping of Binary 1:1 Relation Types

    • For each binary 1:1 relationship type R, identify the relations S and T that correspond to the entity types participating in R
    • Choose one of the relations, say S, and include a foreign key in S, the primary key of T
    • It is better to choose an entity type with total participation in R

    Step 4: Mapping of Binary 1:N Relationship Types

    • For each regular binary 1:N relationship type R, identify the relation S that represents the participating entity type at the N-side of the relationship type
    • Include as foreign key in S the primary key of the relation T that represents the other entity type participating in R
    • Include any simple attributes of the 1:N relation type as attributes of S

    Step 5: Mapping of Binary M:N Relationship Types

    • For each regular binary M:N relationship type R, create a new relation S to represent R
    • Include as foreign key attributes in S the primary keys of the relations that represent the participating entity types
    • Also, include any simple attributes of the M:N relationship type as attributes of S

    Step 6: Mapping of Multivalued Attributes

    • For each multivalued attribute A, create a new relation R
    • R includes an attribute corresponding to A, plus the primary key attribute K as a foreign key in R
    • The primary key of R is the combination of A and K

    Step 7: Mapping of N-ary Relationship Types

    • For each n-ary relationship type R, create a new relation S to represent R
    • Include as foreign key attributes in S the primary keys of the relations that represent the participating entity types
    • Also, include any simple attributes of the n-ary relationship type as attributes of S

    Mapping EER Model Constructs to Relations

    • Step 8: Options for mapping specialization or generalization
    • Step 9: Mapping of union types (categories)

    Step 8: Options for Mapping Specialization or Generalization

    • Option 8A: Multiple relations - superclasses and subclasses
    • Option 8B: Multiple relations - subclass relations only
    • Option 8C: Single relation with one type attribute
    • Option 8D: Single relation with multiple type attributes

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    This quiz is about mapping n-ary relationship types to new relationships in database design. Learn about the primary keys and foreign key attributes involved in this process.

    Use Quizgecko on...
    Browser
    Browser