WEEK 6, Questions
WEEK 6, Questions
JOINS
DEPARTMENT TABLE
DEPT DBLD DROOM DCHFNO
THEO HU 200 10
CIS SP 300 80
MGT SP 100 -
PHIL HU 100 60
STAFF TABLE
ENAME ETITLE ESALARY DEPT
LUKE EVANGLIST3 53 THEO
MARK EVANGLIST2 52 THEO
MATTHEW EVANGLIST1 51 THEO
NIX CROOK 25001 PHIL
HANK JESTER 25000 PHIL
JOHN EVANGLIST4 54 THEO
EUCLID LAB ASSIST 1000 MATH
ARCHIMEDES LAB ASSIST 200 ENG
DA VINCI LAB ASSIST 500 -
1. For all the staff members assigned to the existing departments, select all information about the
staff members and their respective departments.
2. Display the name salary, department identifier, and building and room location for every staff
member assigned to an existing department whose yearly salary exceeds $1000.
3. For every course with a lab fee over $175, display the course name, lab fee, and faculty number
of the chairperson responsible for the course. Display the output by course name in ascending
sequence.
4. Display the name and title of every staff member who works in the humanities building.
5. Display the building and room of any academic department which employs a staff member
whose title begins with “EVANGLIST”.
6. For each department described in the DEPARTMENT table which employs at least one staff
member, display the department identifier followed by the number of staff members assigned
to the department.
7. For any course which has a staff member available to tutor students, display its number, the
names and titles of the staff members who ca serve as a tutor for the course, and their respective
building and room locations. Sort the output by staff member name within course number.
8. Form the cross product of the STAFF table and the DEPARTMENT table.
9. For each department referenced in the STAFF table, we would like to form a committee
composed of two staff members from the department. For each possible pair of staff members,
display the department identifier followed by the names of two staff members. The result should
contain a row for every possible pair of staff members.
10. Refine the previous example query. For each department identifier referenced at least twice in
the STAFF table, display a row for each possible combination of distinct staff member names.
The row should contain the department identifier followed by staff member names.
11. Assume we would like to compare the salary of every staff member with every course lab fee.
Whenever the salary is less than the lab fee, display the staff member name and salary followed
by the corresponding course name and lab fee.
12. Assume that the dean is considering moving the administrative office of the management
department. The intention is to combine its administrative facilities with those of another
department which is located in the same building (which is unknown to the dean). To evaluate
all possible options, display all information about the management department followed by all
information about any department which is located in the same building.