|
@@ -106,10 +106,22 @@ where c1.term = c2.term and c1.deptcode = c2.deptcode and c1.cnum = c2.cnum and
|
|
|
/*
|
|
|
Pairs of distinct professors such that whenever the first one teaches a class
|
|
|
in a particular term the second also teaches a class for the same course
|
|
|
-in the same term. Report a oprofessor number and name for both the
|
|
|
+in the same term. Report a professor number and name for both the
|
|
|
professors.
|
|
|
*/
|
|
|
-
|
|
|
+select pnum, pname, pnum2, pname2 from professor, (select pnum as pnum2, pname as pname2 from professor where pnum in
|
|
|
+ (
|
|
|
+ select pnum from class where deptcode = c.deptcode and cnum = c.cnum and term = c.term and pnum != c.pnum
|
|
|
+ )) as subquery where pnum in
|
|
|
+(
|
|
|
+ select pnum, deptcode, cnum, term from class c where exists
|
|
|
+ (
|
|
|
+ select pnum as pnum2, pname as pname2 from professor where pnum in
|
|
|
+ (
|
|
|
+ select pnum from class where deptcode = c.deptcode and cnum = c.cnum and term = c.term and pnum != c.pnum
|
|
|
+ )
|
|
|
+ )
|
|
|
+)
|
|
|
|
|
|
-- NOW CAN USE AGGREGATION
|
|
|
|