Discrete Mathematics for Computer Science

(Romina) #1
Relational Databases: An Introduction 203

A database system provides a framework for representing complex relationships. In
this section, we will discuss one model for a database system called a relational database
system. The reason we call this model a relational database system will become clear as we
work through an example. To simplify the discussion, we will present simplified versions
of the database operations.

3.10.1 Storing Information in Relations

To introduce some of the features of a relational database system, we consider the rela-
tional representation of a familiar problem: How can we keep track of student registrations
in classes and teaching assignments of instructors. This section shows how a relational
database system could be used.
The first requirement is to store the information about which students have registered
for which classes at a university. In this example, John von Neumann, Emmy Noether, and
Herman Hollerith are all taking English 101, section 3. George Boole, Rend Descartes,
and Winston Churchill are taking English 101, section 4. John von Neumann and Emmy
Noether are also taking English 103, section 1. George Boole and Winston Churchill are
also taking Mathematics 101, section 1. Finally, Ren6 Descartes and Herman Hollerith are
also taking Computer Science 103, section 3. This information is collected in Table 3.11.

Table 3.11 Registration Relation
Registration
Student Department Course Section
John von Neumann English 101 3
Emmy Noether English 101 3
Herman Hollerith English 101 3
George Boole English 101 4
Ren6 Descartes English 101 4
Winston Churchill English 101 4
John von Neumann English 103 1
Emmy Noether English 103 1
George Boole Mathematics 101 1
Winston Churchill Mathematics 101 1
Rene Descartes Computer Science 103 3

Herman Hollerith Computer Science (^103 3)
In a relational database, the n-tuples in an n-ary relation are simply called tuples.
The relations themselves are called tables. Each column in a table is an attribute, and the
values that appear in that column are referred to as values of that attribute.
In this example, many other 4-tuples (or quadruples) could be in the Registration
relation, such as (George Boole, English 103, 4) or (Herman Hollerith, Mathematics, 103,
3). A 4-tuple is in the relation only if the student is registered for that section of that course.
Now, suppose a second relation is defined that records the professors for the various
courses. It is possible to make a 5-ary relation that stores all the information in Registra-
tion plus the name of the professor for each course. However, the information about who

Free download pdf