08.02.2014 Views

Web-DSS-Chapter-03

Web-DSS-Chapter-03

Web-DSS-Chapter-03

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

38 CHAPTER 3 ■ Entity-Relationship Modeling<br />

Name<br />

StudentID<br />

Address<br />

STUDENT<br />

Figure 3.4 The key attribute.<br />

A composite key must be minimal in the sense that no subset of a composite key can form<br />

the key of the entity instance. For example, if a composite key has four attributes, A1 to A4, then<br />

any subset, say A2, A4 or A2, A3 (or any of 16 combinations), should not form a key for an<br />

entity. In other words, we need all attributes, A1–A4, to identify each instance of an entity<br />

uniquely. In the E-R diagram, we underline each attribute in the composite key.<br />

For example, consider the CITY entity type (see Figure 3.5). This category includes, potentially,<br />

all the cities in the United States. Notice that none of the attributes (i.e. Name, State or<br />

Population) can serve as a key attribute since there are many cities in each state and two cities<br />

could possibly have the same name or population. However, the composite attribute {Name,<br />

State} is a valid key attribute for the CITY entity as no two cities within a state can have the same<br />

name.<br />

An entity can have more than one attribute that qualifies to be an identifier. For the entity<br />

shown in Figure 3.6, each of the attributes Name, StateAbbr, and UnionOrder (the order in<br />

which the state entered the union of the United States) can be an identifier. In this case, it is a<br />

matter of preference as to which attribute is made an identifier or key attribute.<br />

State<br />

Name<br />

Population<br />

CITY<br />

Figure 3.5 The composite key attribute.

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

Saved successfully!

Ooh no, something went wrong!