Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following queries in relational algebra, using the university schema.

ID: 3851532 • Letter: W

Question

Write the following queries in relational algebra, using the university schema. (Appendix A, page 1271) a. Find the names of all students who have taken at least one Comp. Sci. course. b. Find the IDs and names of all students who have not taken any course offering before Spring 2009. c. For each department, find the maximum salary of instructors in that department. You may assume that every department has at least one instructor. d. Find the lowest, across all departments, of the per-department maximum salary computed by the preceding query.

Explanation / Answer

A) Answer: select name from student natural join takes natural join course where course.dept='Comp.Sci'

But) Answer: select id,name from student natural join takes except select id,name from student natural join takes where year<2009;

C) Answer: select dept_name,max(salary) from instructor group by dept_name;

D) Answer: select min(maximum_salary) from (select dept_name,max(salary) as maximum_salary from instructor group by dept_name;