Discrete Mathematics for Computer Science

(Romina) #1

204 CHAPTER 3 Relations


is teaching a course is often used for purposes independent of determining who is regis-
tered for the course. It therefore is better to store the new information in a separate table.
The information about the professors is contained in the relation TeachingAssignments,
which is shown in Table 3.12. The value of the relational database will be seen when we
explain how information from various tables can be combined to answer questions. In this
case, we might want to use the two tables Registration and TeachingAssignments to list the
professors of a particular student.

Table 3.12 TeachingAssignments Relation

TeachingAssignments
Department Course Section Professor
English 101 3 Geoffrey Chaucer
English 101 4 William Morris
English 103 1 Thomas Jefferson
Mathematics 101 1 David Hilbert

Mathematics (^101 1) Leonardo of Pisa
Computer Science 103 3 Alan Turing
Some information from Registration is repeated in TeachingAssignments. One prob-
lem in designing the relations in a relational database systems is to manage the needed
redundancy in a set of tables.
Each row in the table TeachingAssignments is a 4-tuple, and the relation is the set of
4-tuples that record the teaching assignments for each course. Note that David Hilbert and
Leonardo of Pisa are probably team-teaching Mathematics 101, section 1.
Finally, because the total teaching program in each department is the responsibility of
a department chair, a relation that gives this information is needed. This relation consists
of a set of tuples of length two, or ordered pairs, as seen in Table 3.13.
Table3.13 DepartmentChair Relation
DepartmentChair
Department Chair
English Francis Bacon
Mathematics Carl Gauss
Computer Science Alan Turing
A set of relations, such as the three shown in this example, are the data used by a
relational database system.


3.10.2 Relational Algebra

In designing the data for a database system, three things are important. First, how are the
data and relationships stored? Second, how can the data be modified? Third, can informa-
tion be extracted? As already noted, the data and relationships are stored in tables. Methods
to modify the data will not be discussed here; a course devoted to file processing will spend
much time dealing with just the problems you face in implementing a database system.
Free download pdf