next up previous
Next: About this document

centering17

Consider a relational database for a university registrar's office, with relations student, class, instructor, teaches, and taking. The schemes of these relations are:

Student-scheme = (name, standing, student-num)
Class-scheme = (department, number, days, time, place, enrollment)
Instructor-scheme = (name, department, office)
Teaches-scheme = (name, office, department, number)
Taking-scheme = (student-num, department, number, grade)

where the value of attribute standing is one of {freshman, sophomore, junior, senior}, and the department attributes in Teaches-scheme and Taking-scheme refer to the class, rather than to the instructor or student. The teaches relation is intended to represent relationships between instructors and classes, and the taking relation is intended to represent relationships between students and classes.

Write relational algebra expressions for each of the following queries:

  1. (3 pts) Find the department and number of all classes with fewer than 9 students enrolled.
  2. (4 pts) Assume that Elvis Presley is a student at the university. Find the names of all students with the same standing as Elvis Presley.
  3. (5 pts) Find the names of all students taking Comp 419, where Comp is the department and 419 is the number. Do not use any natural joins in your answer.
  4. (3 pts) Do problem 3 again, but use at least one natural join in your answer.
  5. (6 pts) Find the name and standing of all students taking a course taught by Tim Wahls.
  6. (3 pts) Write a different relational algebra expression for the query given in problem 5.




Tim Wahls
Tue Jan 28 14:15:36 EST 1997