1 / 6

Mapping ER to Relational Model

Mapping ER to Relational Model. Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity set. To create a table for an entity set: Non-composite, single-valued attributes become attributes of the table.

morag
Télécharger la présentation

Mapping ER to Relational Model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity set. To create a table for an entity set: • Non-composite, single-valued attributes become attributes of the table

  2. Mapping ER to Relational Model To create a table for an entity set: • Composite attributes: either make the composite a single attribute or use individual attributes for components, ignoring the composite • Multi-valued attributes: remove them to a new table along with the primary key of the original table (still keep the primary key in original table)

  3. Mapping ER to Relational Model • Binary Relationships: • 1:M- place the primary key of 1 side in table of M side as foreign key • 1:1- use the primary key of one of the two tables as foreign key in the other table • M:M- create a relationship table with primary keys of related entities, along with any relationship attributes

  4. Mapping ER to Relational Model • Ternary or higher degree relationships: construct relationship table composed of primary keys of the participating entity sets, along with any relationship attributes

  5. Keys in Relation Model • Relations (tables) never have duplicate records, so you can always tell records apart; implies there is always a key (which may be a composite of all attributes, in worst case) • Superkey: set of attributes that uniquely identifies records • Candidate key: a superkey such that no proper subset of itself is also a superkey (i.e. it has no unnecessary attributes) • Primary key: The candidate key chosen for unique identification of records • A foreign key is an attribute or combination of attributes that is the primary key of some relation (referred to as the home relation of the foreign key)

  6. Integrity Constraints • Integrity constraints are rules or restrictions that apply to all instances of the database • Types of constraints • Domain constraint - limits set of values for attribute • Entity integrity: no attribute of a primary key can have a null value • Referential integrity: each foreign key value must match the primary key value of some record in its home relation or be completely null. • General constraints or business rules: may be expressed as extra table constraints or assertions

More Related