0% found this document useful (0 votes)
28 views12 pages

Mapping ERD Into Relations

1. The document outlines steps to transform an ER/EER diagram into equivalent logical relations, including mapping different entity and relationship types into tables and relationships between tables. 2. Key steps include mapping regular entities and their attributes, weak entities, binary relationships of different cardinalities, associative entities, unary relationships, and supertype/subtype relationships. 3. The goal is to establish relationships between tables that accurately represent the relationships, constraints, and participation defined in the original ER/EER diagram.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views12 pages

Mapping ERD Into Relations

1. The document outlines steps to transform an ER/EER diagram into equivalent logical relations, including mapping different entity and relationship types into tables and relationships between tables. 2. Key steps include mapping regular entities and their attributes, weak entities, binary relationships of different cardinalities, associative entities, unary relationships, and supertype/subtype relationships. 3. The goal is to establish relationships between tables that accurately represent the relationships, constraints, and participation defined in the original ER/EER diagram.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Transforming ERD/EERD

Into Relations
Database Management System I
Objectives of this Chapter
• Explain the various restrictions on data that can be specified on a
relational database in the form of constraints.
• Establish and identify the relationships between tables.
• Transform an ER/EER Diagram into logical equivalent set of relations.
Step 1: Map Regular Entity
• Each simple column of the ER diagram becomes the column of the relations and
the identifier becomes the primary key of the relations.
• When a regular entity type has a composite column, only the simple component
columns are included in the relations.

Mapping Strong Entity with Composite Attributes


Step 1: Map Regular Entity
• When the regular entity contains a multivalued column, two new relations are
created. First relation contains all of the columns from the entity type except the
multivalued column. Second relation contains two columns: the multivalued
columns as the primary key from the first relation, which becomes the foreign
key in the second relations.

Mapping Strong Entity with Multivalued Attributes


Step 2: Weak Entity
• Create a new relation and include all of the simple columns of this relation;
include the primary key of the identifying owner as a foreign key column in this
relation.

Example 1
Example 2
Step 3: Map Binary Relationship
The procedure for representing relationship depends on both the degree of
relationships and the cardinalities of the relationships.
Map Binary One-to-Many Relationships
1. Create relation for each of the two entity types participating in the relationship, use the procedure
described in Step 1.
2. Incorporate the primary key column(s) of the entity on the one side of the relationships as a foreign key in
the relationship that is on the many-side of the relationship.
Step 3: Map Binary Relationship
Map Binary Many-to-Many Relationships
1. Create relation for each of the two entity types participating in the relationship.
2. Create a third relationship; include as foreign key columns in the third relation the primary keys of the
two participating relations.
Step 3: Map Binary Relationship
Map Binary One-to-One Relationships
1. Create relation for each of the two entity types participating in the relationship.
2. The primary key of one of the relations is included as a foreign key in the other relation.

In a 1:1 relationship, the association in one


direction is nearly always optional, while the
association in the other direction is a mandatory
one. The rule is to include a foreign key on the
optional side of the relationship the primary key of
the mandatory participation in the 1:1 relationship.
Step 4: Map Associative Entities
Identifier Not Assigned Identifier Assigned

The default primary key for the associative relation If a surrogate identifier is assigned to the associative entity
consists of the two primary key columns from the type, still an associative relation is created. However, the
other two relations. These columns are the foreign primary key for this relation is the surrogate identifier and the
keys that reference from the other two relations. primary keys of the two participating entity types are then
included as its foreign keys.
Step 5: Map Unary Relationships
Unary One-to-Many Relationship Unary Many-to-Many Relationships

The primary key of the same entity type is


used as a foreign key in the same relation and Two relations are created: one to represent the entity
with a different name since the same column type in the relationship, and the other one, the
associative relation to representing the M: N relationship
name cannot be used in the same table.
itself. The primary key of the associative relation is
composed of two columns.
Step 6: Map Ternary Relationships
• This relationship type involves many to
many relationships between three
relationships between three entity
types.
• It is recommended to convert a ternary
relationship to an associative entity to
represent participation constraints
more accurately.
• In mapping an associative type that
connects the three regular entity types
creates a new associative relation.
• The associative entity has entity has
foreign keys to each entity type.
Step 7: Map Supertype/Subtype Relationships
Strategies to represent these in the relational
model:
1. Create a separate relation for the
supertype and each of the subtypes.
2. Assign to the relation the columns that
are common to all members of the
supertype, including the primary key.
3. Assign to the relation for each subtype
the primary key of the supertype only
those columns that are unique to that
subtype.
4. Supertype columns include the identifier
and subtype discriminator go to in the
supertype relation.

You might also like