Page 33 - Discrete Structure II
P. 33
2. Give an example of a relation R (3 elements at least) on I, F, L and G.
I ={326895, 225867, 125369, 896731}
F={Mercedes, John, Paul, Kathy}
L = {Suarez, Doe, Gunter, Henry}
G ={3.4, 2.75, 2.98, 3.8}
R = {(326895, Mercedes, Suarez, 3.4), (225867, Paul, Gunter, 2.98), (125369, Paul, Doe, 2.98,
896731, Kathy, Henry, 2,75)}
ID Number First Name Last Name GPA
326895 Mercedes Suarez 3.4
225867 Paul Gunter 2.98
125369 Paul Doe 2.98
896731 Kathy Henry 2.75
Id Number, FirstName, LastName, GPA are called fields.
The rows are called records.
The field that uniquely determines a record is called Primary Key.
Schema (IdNumber, FirstName, LastName, GPA).
Projection Operator
The projection Operator maps the n-tuple (a1, a2, …, an) to the fields specified by the projector operator
indices.
Example
p1, 3 (a1, a2, a3, a4) = (a1, a3)
p2, 3 (a1, a2, a3, a4) = (a2, a3)
p1, 4 (2, 3, 0 , 4) = (2, 4)
p1, 2, 4 (2, 3, 0, 5 , 4, 7, 8) = (2, 3, 5)
p2, 3, 5 (2, 3, 0, 5 , 4, 7, 8) =(3, 0, 4)