|
@@ -7,15 +7,9 @@ name “computer science”.
|
|
|
*/
|
|
|
select distinct sname, snum from student where year = 2 and snum in
|
|
|
(
|
|
|
- select snum from mark m1 where grade < 65 and deptcode in
|
|
|
+ select snum from mark m1 where grade < 65 and deptcode = "CS" and snum in
|
|
|
(
|
|
|
- select deptcode from department where deptname = "computer science"
|
|
|
- ) /*having count(distinct section) > 1*/ and snum in
|
|
|
- (
|
|
|
- select snum from mark where grade < 65 and deptcode in
|
|
|
- (
|
|
|
- select deptcode from department where deptname = "computer science"
|
|
|
- ) and snum != m1.snum
|
|
|
+ select snum from mark where grade < 65 and deptcode = "CS" and snum != m1.snum
|
|
|
)
|
|
|
)
|
|
|
|
|
@@ -49,22 +43,27 @@ select distinct snum, sname, year from student where snum in
|
|
|
have a final grade of at least 85 in every computer science course that
|
|
|
they have taken, and who have always been taught by a professor in the
|
|
|
computer science (CS) department.
|
|
|
-ASSUMING THIS PROFESSOR RESTRICTION ONLY APPLIES TO THE CS COURSES
|
|
|
*/
|
|
|
select distinct snum, sname from student where year > 2 and snum not in
|
|
|
(
|
|
|
select snum, grade from mark where deptcode = "CS" and grade < 85
|
|
|
) and snum not in
|
|
|
(
|
|
|
- select snum as prev_snum, deptcode as prev_deptcode, cnum as prev_cnum, term as prev_term, section as prev_section from mark where cnum in
|
|
|
+ select e.snum, e.deptcode, e.cnum, e.term, e.section from enrollment e where exists
|
|
|
(
|
|
|
- select pnum, cnum from class where prev_deptcode = deptcode and prev_cnum = cnum and prev_term = term and prev_section = section and pnum in
|
|
|
+ select c.pnum, c.deptcode, c.cnum, c.term, c.section from class c where
|
|
|
+ c.deptcode = e.deptcode and c.cnum = e.cnum and c.term = e.term and c.section = e.section and c.pnum not in
|
|
|
(
|
|
|
- select pnum from professor where deptcode = prev_deptcode
|
|
|
+ select pnum from professor where deptcode != "CS"
|
|
|
)
|
|
|
)
|
|
|
)
|
|
|
|
|
|
+select c.pnum, c.deptcode, c.cnum, c.term, c.section from class c where c.pnum not in
|
|
|
+(
|
|
|
+ select pnum from professor where deptcode != "CS"
|
|
|
+)
|
|
|
+
|
|
|
/*
|
|
|
A sorted list of all departments who do not have a professor currently
|
|
|
teaching a course offered by a different department.
|