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.

.rre the<br />

,.d into<br />

sofan<br />

.rsually<br />

itv set.<br />

I'ntifr<br />

/PANY<br />

:'SilITl€<br />

-lrlrrL/<br />

a c0n1ributes<br />

hat lve<br />

)ute of<br />

Icomrllque-<br />

In ER<br />

Lc oval,<br />

,'.'dir-rg<br />

.itisa<br />

he key<br />

ther, it<br />

I other<br />

ld that<br />

.3"<br />

3.3 Entity Types, Entity Sets, Attributes, and Keys<br />

Some entity types have more than one key attribute. For example, each of the<br />

Vehicle_id and Registration attributes of the entity type CAR (Figure 3.7) is a key in its<br />

orvn right. The Registration attribute is an example of a composite key formed from<br />

trvo simple component attributes, State and Number, neither of which is a key on its<br />

orvn. An entity type may also have no key,in which case it is called a weak entity type<br />

see Section 3.5).<br />

Value Sets (Domains) of Attributes. Each simple attribute of an entity type is<br />

associated with a value set (or domain of values), which specifies the set of values<br />

that may be assigned to that attribute for each individual entity. In Figure 3.6, if the<br />

range of ages allowed for employees is between 16 and 70, we can specifr the value<br />

let of the Age attribute of eVpLOYf E to be the set of integer numbers between 16<br />

and 70. Similarly, we can specify the value set for the Name attribute to be the set of<br />

strings ofalphabetic characters separated by blank characters, and so on. Value sets<br />

are not displayed in ER diagrams. Value sets are typically specified using the basic<br />

data types available in most programming languages, such as integer, string,<br />

Boolean, float, enumerated type, subrange, and so on. Additional data types to represent<br />

date, time, and other concepts are also employed.<br />

(a)<br />

(b)<br />

CAR<br />

Registration (Number, State), Vehicle_id, Make, Model, Year, {Color}<br />

cARl<br />

((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 2004 {red, black})<br />

cAR2<br />

((ABC 123, NEW YORK), WP9872, Nissan Maxima, 4-door, 2005, {blue})<br />

cAR3<br />

((VSY 720, TEXAS), fD729, Chrysler LeBaron, 4-door, 2002, {white, blue})<br />

Figure 3.7<br />

The CAR entity type with two<br />

key attributes, Registration and<br />

Vehicle_id, (a) ER diagram<br />

notaiion. (t-r) Fntitv set with<br />

three entities.<br />

$ t

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

Saved successfully!

Ooh no, something went wrong!