s
Section 5.3 Relations and Databases
367
value), so a given tuple could have a NULL value for one or more of its attributes.
Any tuple (x 1 , x 2 , …, x n ) in a relation table must satisfy the n-ary predicate of the
form (4x i )(x i [ D i ).
example 20
The Person relation in the PLAC database might contain the following data.
person
Name
address
city
State
Patrick, Tom
2425 Samset
Sarasota
FL
Smith, Mary
1121 Ridge Rd.
Rockville
IL
Collier, Jon
429 Via Rivio
Venice
IL
Jones, Kate
345 Forest St.
Cleveland
OH
Smith, Bob
1201 45th St.
Falls City
MA
White, Janet
110 Toledo Rd.
Brookville
GA
Garcia, Maria
24 E. 56th St.
New York City
NY
The four attributes for each tuple are Name, Address, City, and State. The metadata specify that the domain for the Name attribute is the set of strings of the form
LastName, FirstName; the domain for the State attribute is the set of legitimate
two-character state abbreviations. The Pet relation could be
pet
petName
petType
Breed
Spot
Dog
Hound
Twinkles
Cat
Siamese
Lad
Dog
Collie
Lassie
Dog
Collie
Mohawk
Fish
Moorish idol
Tweetie
Bird
Canary
Tiger
Cat
Shorthair
Because there are no duplicate tuples in a relation, giving the value of all n
attributes of a tuple clearly distinguishes that tuple from all others. However, there
may be a minimal subset of the attributes that can be used to uniquely identify
each tuple. This subset is called the primary key of the relation; if the subset consists of more than one attribute, then it is a composite primary key. In the table
describing the relation (and in the E-R diagram), the primary key is underlined in
the row of attribute names. No component of the primary key should ever have a
NULL (empty) value. This entity integrity constraint merely confirms that each
Précédent

- 384/986

Suivant