CSE3330 Homework #2
Due on Thursday October 11, before midnight
Worth 4% of the final grade
- (50 points)
Consider the following relational schema:
department ( name, chair )
professor ( ssn, name, employer )
student ( SID, name, dept )
course ( name, offered_by )
section ( course, number, taught_by, credits )
enrollment ( course, number, student )
that has the following foreign keys:
department.chair → professor.ssn
professor.employer → department.name
student.dept → department.name
course.offered_by → department.name
section.course → course.name
section.taught_by → professor.ssn
enrollment.course → section.course
enrollment.number → section.number
enrollment.student → student.SID
Based on this schema, express the following queries in SQL (10 points for each query).
- print the total number of students who are enrolled in cse3330, section 1.
- for each department, print the department name and the total number of courses offered by this department.
- for each student, print her name and her total number of credits of all the courses she is currently enrolled.
- for each course offered by CSE, print the course name and the total number of students enrolled in this course.
- for each section, print the course name, the section number, and the total number of
students enrolled in this section only if this number is greater than 20 students.
- (50 points)
Based on the relational schema given in
Problem 1, express the following queries in relational algebra
(10 points for each query).
- print the course names taught by professor John Smith.
- print the student names who are enrolled in cse3330, section 1.
- print the professor names who teach cse3330 but not cse2320.
- print the course names and section numbers enrolled by the student Mary Jones.
- print the course names and section numbers of all sections that
are taught by a professor who is not employed by the department that offers this course.
How to Submit the Homework
You need to submit your homework solution online using the following web form.
Acceptable document formats are: plain text, Microsoft word document, PDF, and postscript.
You may submit it as many times as you like,
but only the most recently submitted file will be retained and evaluated.
Not that, this time we will not accept any email or hardcopy submission.
If you cannot login or have a problem submitting the homework using this form, ask the GTA for help.
Last modified: 09/27/12 by Leonidas Fegaras