The document outlines the mapping of various binary relationship types in an Entity-Relationship (ER) schema, including 1:1, 1:N, and M:N relationships. It describes three approaches for 1:1 relationships (foreign key, merged relationship, and cross-reference), and details the mapping process for 1:N and M:N relationships, emphasizing the creation of new relations to represent these relationships. Additionally, it covers the mapping of multivalued attributes and N-ary relationship types, providing examples for clarity.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
ER-to-Relational Algorithm
The document outlines the mapping of various binary relationship types in an Entity-Relationship (ER) schema, including 1:1, 1:N, and M:N relationships. It describes three approaches for 1:1 relationships (foreign key, merged relationship, and cross-reference), and details the mapping process for 1:N and M:N relationships, emphasizing the creation of new relations to represent these relationships. Additionally, it covers the mapping of multivalued attributes and N-ary relationship types, providing examples for clarity.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20
Step3 : Mapping of Binary
1:1 Relation Types
For each binary 1:1 relation type R in the ER schema, identify the relations S and T that correspond to the entity types participating in the R. There are three possible approaches:
1) the foreign key approach ,
2) the emerged relationship approach , and 3) the cross-reference or relationship relation approach
04/02/25 Lecture presentation by Shashidhar Kini K 1
The foreign key approach Mostly used Include Primary key of one relation as foreign key in other relation (generally in the relation which has total participation)
e.g. MGRSSN as foreign key in DEPARTMENT
which is primary key in EMPLOYEE due to relation of MANAGES
Because DEPARTMENT entity participation in
manages is total. 04/02/25 Lecture presentation by Shashidhar Kini K 2 Step3 : Mapping of Binary 1:1 Relation Types
04/02/25 Lecture presentation by Shashidhar Kini K 3
The Merged relationship approach Merge two entity types and their relationship type in a single relation .
Suitable only when total participation of both the
entity exists.
But not widely used
04/02/25 Lecture presentation by Shashidhar Kini K 4
The cross-reference or relationship relation approach Create a new relation for relationship type.
Include Primary keys of both the relations as foreign
key in new relation.
Both primary key together works as composite
primary key for new relation.
Used when both entity participation is partial (to avoid
more nulls) 04/02/25 Lecture presentation by Shashidhar Kini K 5 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 the primary key of the relation T that
represents the other entity type participating in R as foreign key in S
04/02/25 Lecture presentation by Shashidhar Kini K 6
Step 4: Mapping of binary 1:N Relationship types This is done because each entity instance on the N-side is related to at most one entity instance on the 1-side of the relationship type.
Include any simple attributes (or simple
components of the composite attributes) of the 1:N relationship type as attribute of S.
04/02/25 Lecture presentation by Shashidhar Kini K 7
Step 4: Mapping of binary 1:N Relationship types Example: 1:N relationship types WORKS_FOR,
CONTROLS, and SUPERVISION in the figure.
For WORKS_FOR we include the primary key
DNUMBER of the DEPARTMENT relation as foreign key in the EMPLOYEE relation and call it DNO.
04/02/25 Lecture presentation by Shashidhar Kini K 8
Step 4: Mapping of binary 1:N Relationship types
04/02/25 Lecture presentation by Shashidhar Kini K 9
Step 4: Mapping of binary 1:N Relationship types
04/02/25 Lecture presentation by Shashidhar Kini K 10
Step 5: Mapping of binary M:N Relationship Types For each binary M:N relationship type R, create a new relation S to represent R.
Include the primary keys of the relations that
represent the participating entity types as foreign key attributes in S
Their combination will form the primary key of S.
04/02/25 Lecture presentation by Shashidhar Kini K 11
Step 5: Mapping of binary M:N Relationship Types Also include any simple attributes of the M:N relationship type (or simple components of composite attributes) as attributes so S.
We cannot represent an M:N relationship type by a
single foreign key attribute in one of the participating relations ( as we did fro 1:1 or 1:N relationship types ) because of the M:N cardinality ratio ;we must create a separate relationship relation S.
04/02/25 Lecture presentation by Shashidhar Kini K 12
Step 5: Mapping of binary M:N Relationship Types Example: The M:N relationship type WORKS_ON from the ER
diagram is mapped by creating a relation
WORKS_ON in the relational database schema. The primary keys of the PROJECT and EMPLOYEE relations are included as foreign keys in WORKS_ON and renamed PNO and ESSN, respectively. Attribute HOURS in WORKS_ON represents the
HOURS attribute of the relation type. The primary
key of the WORKS_ON relation is the combination of the foreign key attributes {ESSN, PNO}. 04/02/25 Lecture presentation by Shashidhar Kini K 13 Step 5: Mapping of binary M:N Relationship Types
EMPLOYEE PROJECT WORKS_ON
04/02/25 Lecture presentation by Shashidhar Kini K 14
Step 6: Mapping of the multivalued Attributes For each multivalued attribute A, create a new relation R .
This relation R will include an attribute corresponding
to A , plus the primary key attribute K of main relation as a foreign key in new relation
The primary key of R is the combination of A and K .
If the multivalued attribute is composite , we include
its simple components 04/02/25 Lecture presentation by Shashidhar Kini K 15 Step 6: Mapping of the multivalued Attributes Example: The relation DEPT_LOCATIONS is created. The
attribute DLOCATION represents the multivalued
attribute LOCATIONS of DEPARTMENT, while DNUMBER-as foreign key-represents the primary key of the DEPARTMENT relation. The primary key of R is the combination of {DNUMBER, DLOCATION}.
04/02/25 Lecture presentation by Shashidhar Kini K 16
Step 7: Mapping of N-ary relationship Types For each n-ary relationship type , where n>2 , create a new relation S to represent Relationship type.
Include the primary keys of the relations that
represent the participating entity types as foreign key attributes in S .
04/02/25 Lecture presentation by Shashidhar Kini K 17
Step 7: Mapping of N-ary relationship Types Also include any simple attributes of the n-ary relationship type (or simple components of composite attributes) as attributes for S .
The primary key of S is usually a combination of all
the foreign keys that references the relations representing the participating entity types .
04/02/25 Lecture presentation by Shashidhar Kini K 18
Step 7: Mapping of N-ary relationship Types Example: The relationship type SUPPY in the ER below. This
can be mapped to the relation SUPPLY shown in the
relational schema, whose primary key is the combination of the three foreign keys {SNAME, PARTNO, PROJNAME}
04/02/25 Lecture presentation by Shashidhar Kini K 19
Step 7: Mapping of N-ary relationship Types
04/02/25 Lecture presentation by Shashidhar Kini K 20
[FREE PDF sample] Graph Theoretic Concepts in Computer Science 42nd International Workshop WG 2016 Istanbul Turkey June 22 24 2016 Revised Selected Papers 1st Edition Pinar Heggernes (Eds.) ebooks