16.11.2012 Views

this pdf excerpt

this pdf excerpt

this pdf excerpt

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Figure 3.12<br />

A 1:1 relationship,<br />

MANAGES.<br />

3.4.3 Constraints on Relationship Types<br />

Relationship types usually have certain constraints that limit the possible combinations<br />

of entities that rnay participate in the corresponding reiationship set. These<br />

constraints are deternrined from the miniworld situation that the relationships represent.<br />

For exanrple, in Figure 3.9, if the contpany has a rule that each employee<br />

must work for exactll, one department, then we would like to describe <strong>this</strong> constraint<br />

in the schema. We can distinguish two main types of relationship constraints:<br />

cardinality rotio and porticipation.<br />

Cardinality Ratios for Binary Relationships. The cardinality ratio for a binary<br />

relationship specifies the rnaxinuri number of relationship instances that an entity<br />

can participate in. For example, in the WORKS_FOR binary relationship type,<br />

DEPARTMENT:EMPLOYEE is of cardinality ratio 1:N, meaning that each department<br />

can be related to (that is, eniploys) any nun"rber of employees,e but an employee can<br />

be related to (work for) only one department. The possible cardinality ratios for<br />

binary relationship types are 1:i, 1:N, N:1, and M:N.<br />

An examprle of a l:l binary relationship is MANAGES (Figure 3.12), which relares a<br />

department entity to the employee who manages that department. This represents<br />

the minirvorld constraints that-at any point in time-an ernployee can manage<br />

one departrnent only and a department can have one manager only. The relationship<br />

type WORKS_ON (Figure 3.13) is of cardinality ratio M:N because the niniworld<br />

rule is that an employee can work on several projects and a project can have<br />

several employees.<br />

EMPLOYEE MANAGES DEPARTMENT<br />

9, N stands Ior any number of related entitles (zero or more),<br />

d1<br />

d2<br />

ds

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

Saved successfully!

Ooh no, something went wrong!