??? ???? ????? ?????? ?? ??????
Problem I: SQL Queries (30 points).
In this problem, you will use a database that stores information on employees and the departments and projects they work for.
Suppose we have a relation Employees (SSN, name, department, salary) from Assignment #1.
For each of the following queries, translate your relational algebra queries from Assignment #1 to SQL queries for each of the queries below (4 points each except h)
Find all department(s) with at least two employees of different names.
Find the department(s) with the most people.
Find the names of employee(s) with the second highest salary.
For each employee, find their name and their supervisorâs name.
Find the supervisor with the lowest salary
Find the number of supervisor in every department.
Find all employees who are not supervisors.
Find the names and SSN of employees who work for the Research department (2 points)
Problem II: (30 points)
Write SQL queries that answer the questions below (one query per question) and run them on system you are most familiar with. The query answers should be duplicate free, but you should use distinct only when necessary.
1. Print the names of professors who work in departments that have fewer than 50 PhD students.
2. Print the name(s) of student(s) with the lowest gpa.
3. For each Computer Sciences class, print the cno, sectno, and the average gpa of the students
enrolled in the class.
4. Print the names and section numbers of all classes with more than six students enrolled in
them.
5. Print the name(s) and sid(s) of the student(s) enrolled in the most classes.
6. Print the names of departments that have one or more majors who are under 18 years old.
7. Print the names and majors of students who are taking one of the College Geometry courses.
(Hint: Youâll need to use the “like” predicate and the string matching character in your query.)
8. For those departments that have no majors taking a College Geometry course, print the …





