03 Mapping
03 Mapping
Chapter-9 of Navathe
Representation of Relations
STUDENTLOAN
loanNo dateIssued Amount interest Institute StudentId
STUDENT
Institute Stdid Fathername
Mapping One-to-Many/Many-
to-One Binary Relationships
• Let S be the participating entity on the many-side and T
the other entity. Let S' and T' be the corresponding
relations.
• Include primary key of T' as foreign key in S‘.
• Include any simple attribute (and simple components of
composite attributes) of reltionship set as attributes of S‘.
Example
Mapping Many-to- Many
Binary Relationships
• Make a separate relation T for this relationship R
between entity sets E1 and E2.
• Let R1 and R2 be the relations corresponding to E1 and
E2 .
• Include primary key attributes of R1 and R2 as foreign
keys in T. Their combination is the primary key in T.
Example
1 M
SUPPLY
Sname Part_no Proj_name quantity
• Simple attribute
• Attribute
Approach2:
• Make no relation for super type. Make separate relations for all sub types.
Repeat super type attributes in each relation.
• Works only for total specialization and disjoint cases. For partial specialization,
some entities may be lost. For overlapping, attributes will be redundantly stored
in two or more relations.
Example
Example
Mapping Super/Sub Entity
Sets
Single-relation approach
• Good if subtypes have only few attributes.
Approach 1:
• Make a single relation and include all attributes of super type and subtype entity
sets.
• Include as many boolean attributes as there are subtypes.
• Works for disjoint and overlapping cases.
Approach2:
• Make a single relation and include all attributes of super type and subtype entity
sets.
• Include a single attribute called ‘discriminator’ whose value indicates to which
subtype that tuple belongs to.
• Works only for disjoint case. If there are many attributes in a subtype, they may
all be null.
Example
VEHICLE
Vehicle_ Pric License_plat CarFlg Max_sp No_of_p TruckFlg No_of_a
id e e_no eed assenger xles Tonnage
s
Example
Relational Schema
Acknowledgements