16.11.2012 Views

this pdf excerpt

this pdf excerpt

this pdf excerpt

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model<br />

In ER diagrams, total participation (or existence dependency) is displayed as a double<br />

line connecting the participating entity type to the relationship, whereas partial<br />

participation is representedby a single line (see Figure 3.2).<br />

3.4.4 Attributes of Relationship Types<br />

Relationship types can also have attributes, similar to those of entity types. For<br />

example, to record the number of hours per week that an employee works on a particular<br />

project, we can include an attribute Hours for the WORKS_ON relationship<br />

type of Figure 3.13. Another example is to include the date on which a manager<br />

started managing a department via an attribute Start-date for the MANAGES relationship<br />

type of Figure 3.12.<br />

Notice that attributes of I :1 or I :N relationship types can be migrated to one of the<br />

participating entity types. For example, the Start_date attribute for the MANAGES<br />

relationship can be an attribute of either EMPLOYEE or DEPARTMENT, although conceptually<br />

it belongs to MANAGES. This is because MANAGES is a l:1 relationship, so<br />

every department or employee entity participates in at most one relationship instance.<br />

Hence, the value of the Start-date attribute can be determined separately, either by the<br />

participating department entity or by the participating employee (manager) entity.<br />

For a 1:N relationship type, a reiationship attribute can be migrated only to the<br />

entity type on the N-side of the relationship. For example, in Figure 3.9, if the<br />

WORKS-FOR relationship also has an attribute Start_date that indicates when an<br />

employee started working for a department, <strong>this</strong> attribute can be included as an<br />

attribute of EMPLOYEE. This is because each employee works for only one department,<br />

and hence participates in at most one relationship instance in WORKS_FOR.<br />

In both 1: I and l:N relationship types, the decision as to where a relationship attribute<br />

should be placed-as a relationship type attribute or as an attribute of a participating<br />

entity type-is determined subjectively by the schema designer.<br />

For M:N relationship types, some attributes may be determined by the combintttion<br />

of participating entities in a relationship instance, not by any single entity. Such<br />

attributes must be specified as relationship attributes. An example is the Hours attribute<br />

of the M:N relationship WORKS_ON (Figure 3.13); the number of hours an<br />

employee works on a project is determined by an employee-project combination<br />

and not separately by either entity.<br />

3.5 Weak Entity Types<br />

Entity types that do not have key attributes of their own are called weak entity<br />

t1pes. In contrast, regular entity types that do have a key attribute-which include<br />

all the examples we discussed so far-are called strong entity types. Entities<br />

belonging to a weak entity type are identified by being related to specific entities<br />

from another entity type in combination with one of their attribute values. We call<br />

_L-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!