Discrete Mathematics for Computer Science

(Romina) #1
Relational Databases: An Introduction 201

Table 3.17 Registration' Relation
Registration'
Student Department
John von Neumann English
Emmy Noether English
Herman Hollerith English
George Boole English
Ren6 Descartes English
Winston Churchill English
George Boole Mathematics
Winston Churchill Mathematics
Ren6 Descartes Computer Science
Herman Hollerith Computer Science

Example 1. Projection is actually a common operation in areas other than databases.
Look at graphing relations on R^2 , and consider the relation


C = {(x, y) E R2 : (x - 2)^2 + (y -2)2 = 1}

The graph of C is a circle in the plane with center (2, 2) and radius 1. Figure 3.19 shows
the graph of C and its projection onto the x-axis.


(2, 3)
3

2 (1,2) 9(2,2) (3,2)

(2, 1)

1
3

Figure 3.19 The projection of the circle (x - 2)2 + (y - 2)2 = 1 onto the x-axis.

Two values or points on the circle are projected onto each element in the open interval
(1,3).

Third Operation: Join


Consider two relations, such as Registration and TeachingAssignments. Recall it was ar-
gued that since they really store different information, they need to be two separate tables.
Nevertheless, some people using the system will want to know the combined information-
that is, which students are taking which classes (departments, course numbers, and section
numbers) taught by which professors. The join of the two relations puts all the information
together. The relation that is needed, called JoinedRelation, is shown in Table 3.18. The

Free download pdf