HW2.3 - Challenging Relational Algebra
HW2.3 - Challenging Relational Algebra
Below is the domain description for the university scenario from HW1, which may be used in the
problems below. This is solely for reference.
Research universities also use graduate students in their research projects. Graduates students have an SSN, a
name, an age, and a degree program (such as M.S. or Ph. D.). One or more graduate students, work on a
project. A graduate student may work on multiple research projects. When a graduate student is working on a
research project they must be supervised by a professor for that project. A professor may supervise multiple
graduates on one project and/or across many projects. As graduate students could work on multiple projects,
they can have different supervisors for each project they work on. Graduate students also have another, more
senior, graduate student who advises them on what courses to take. This person is a student advisor.
Graduate students in their final year may not have a student advisor assigned to them.
The research university is split into several departments. A department has a number, a name, and a main
office (represented by the office number). Each department has a chairman, who is a professor who runs the
department. A professor may work in one or more departments, and for each department they work for there
is a time percentage that dictates how much time is spent in each department. There are some professors who
work part-time, and their time percentage will not add up to 100%. Graduate students belong to a single
department in which they are working on their degree.
Relational Algebra
Use the following relations from the Research University Schema to answer the problems below.
Relations:
Foreign Keys:
Professor(SSN) Person(SSN)
GraduateStudent(SSN) Person(SSN)
GraduateStudent(AdvisorSSN) GraduateStudent(SSN)
Department(ChairmanSSN) Professor(SSN)
WorksFor(ProfessorSSN) Professor(SSN)
WorksFor(DepartmentNumber) Department(Number)
WorksOn(GraduateStudentSSN) GraduateStudent(SSN)
WorksOn(ProjectNumber) Project(Number)
WorksOn(SupervisingProfessorSSN) Professor(SSN)
For each item below, write relational algebra statements to satisfy the given scenario.
a) Retrieve a list of the specialties of all Professors who supervise for Project 39585 and Project 94892.
A single specialty should not be listed twice, even if two professors share the same specialty.
b) Retrieve the Name and Age of all Graduate Students who work on both Project 29385 and Study in
the Department with Name “Biology”.
c) Retrieve the Name and Rank of all Professors who supervise work on Project 29384 or who Work
For the Department with a Main Office of “R234”.
d) Retrieve the Name and Specialty of all Professors who do not supervise work on any projects.
e) Find the Name and Department of all Graduate Students who work on projects that do not employ
any other graduate students.