Exercises 211
Table 3.20
Projection
Professor
William Morris
David Hilbert
Leonardo of Pisa
Alan Turing
Exercises
- What operations can you apply to the sample relations in Section 3.10.1 to get the
following relations?
(a) Professors and the departments in which they teach courses.
(b) Students and professors from whom they take courses.
(c) Professors and the chairs of the departments in which they teach courses.
(d) Pairs of departments that currently provide courses with the same number. So,
having {English, Mathematics) in the relation would assert that both departments
have courses with a number such as 101. - Use the operations of relational algebra and the sample relations in Section 3.10 to
extract the following information:
(a) The students taking English courses.
(b) The students taking classes from Geoffrey Chaucer or Thomas Jefferson.
(c) The professors teaching courses in departments chaired by Carl Gauss or Alan
Turing.
(d) The students taking classes from professors who teach some class in a department
chaired by Carl Gauss or Alan Turing. - Add to the course scheduling database a relation showing which courses are prerequi-
sites for which other courses. Create some sample entries to illustrate the relations. - (a) Rewrite the two relations Registration and TeachingAssignments as binary relations
between people on the one hand and triples (Department, Course Number, Section
Number) on the other. Does this relation make more sense?
(b) Using this approach, why could you not do Exercise 1(d)? Suggest a meaningful
extra relation that would allow you to do Exercise 1 (d). - What simple operation on relations could you add to make it easy to list the number
of students in classes taught by Alan Turing? (Note: This problem asks you to design
a new type of query. Accordingly, it has no right or wrong answers, but some answers
will be simpler than others.)
Exercises 6 through 12 ask questions about the database shown in the three relations
Students, Grades, and Catalog: