DB Lec 18
DB Lec 18
Database Systems
Lecture 18
Database Management S
ystems
Today’s Agenda
Database Management S
ystems
Database Management S
ystems
FIGURE 7.1
The ER
conceptual
schema
diagram for
the COMPANY
database.
5
Database Management S
ystems
FIGURE 7.2
Result of
mapping the
COMPANY ER
schema into a
relational
schema.
6
Database Management S
ystems
▫ For each weak entity type W in the ER schema with owner entity type
E, create a relation R and include all simple attributes (or simple
components of composite attributes) of W as attributes of R.
▫ In addition, include as foreign key attributes of R the primary key
attribute(s) of the relation(s) that correspond to the owner entity
type(s).
▫ The primary key of R is the combination of the primary key(s) of the
owner(s) and the partial key of the weak entity type W, if any.
Database Management S
ystems
(2) Merged relation option: An alternate mapping of a 1:1 relationship type is possible by
merging the two entity types and the relationship into a single relation. This may be
appropriate when both participations are total.
(3) Cross-reference or relationship relation option: The third alternative is to set up a third
relation R for the purpose of cross-referencing the primary keys of the two relations S and
T representing the entity types.
8
Database Management S
ystems
Database Management S
ystems
Database Management S
ystems
Database Management S
ystems
Database Management S
ystems
FIGURE 4.11
Ternary relationship types. (a) The SUPPLY relationship.
13
Database Management S
ystems
FIGURE 7.3
Mapping the n-ary relationship type SUPPLY from
Figure 4.11a.
14
Database Management S
ystems
Database Management S
ystems
Database Management S
ystems
FIGURE 4.4
EER diagram
notation for
an attribute-
defined
specialization
on JobType.
17
Database Management S
ystems
FIGURE 7.4
Options for mapping specialization or generalization.
(a) Mapping the EER schema in Figure 4.4 using option 8A.
18
Database Management S
ystems
FIGURE 4.3
Generalization. (b) Generalizing CAR and TRUCK into the
superclass VEHICLE.
19
Database Management S
ystems
FIGURE 7.4
Options for mapping specialization or generalization.
(b) Mapping the EER schema in Figure 4.3b using option 8B.
20
Database Management S
ystems
Database Management S
ystems
FIGURE 4.4
EER diagram
notation for
an attribute-
defined
specialization
on JobType.
22
Database Management S
ystems
FIGURE 7.4
Options for mapping specialization or generalization.
(c) Mapping the EER schema in Figure 4.4 using option 8C.
23
Database Management S
ystems
FIGURE 4.5
EER diagram notation for an overlapping (nondisjoint)
specialization.
24
Database Management S
ystems
FIGURE 7.4
Options for mapping specialization or generalization.
(d) Mapping Figure 4.5 using option 8D with Boolean type fields Mflag and
Pflag.
25
Database Management S
ystems
Database Management S
ystems
FIGURE 4.7
A specialization
lattice with
multiple
inheritance for a
UNIVERSITY
database.
27
Database Management S
ystems
FIGURE 7.5
Mapping the EER specialization lattice in Figure 4.6
using multiple options.
28
Database Management S
ystems
Database Management S
ystems
FIGURE 4.8
Two categories (union
types): OWNER and
REGISTERED_VEHICLE.
30
Database Management S
ystems
FIGURE 7.6
Mapping the EER
categories (union
types) in Figure 4.7
to relations.