Sfoglia il codice sorgente

removed aggregation where not allowed

tarfeef101 6 anni fa
parent
commit
bd30897f28
1 ha cambiato i file con 13 aggiunte e 5 eliminazioni
  1. 13 5
      a2/a2.sql

+ 13 - 5
a2/a2.sql

@@ -7,10 +7,16 @@ name “computer science”.
 */
 select distinct sname, snum from student where year = 2 and snum in
 (
-  select snum from mark where grade < 65 and deptcode in
+  select snum as old_snum from mark where grade < 65 and deptcode in
   (
     select deptcode from department where deptname = "computer science"
-  ) having count(distinct section) > 1
+  ) /*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 != old_snum
+  )
 )
 
 /*
@@ -22,8 +28,11 @@ select distinct pnum, pname from professor where deptcode not in
   select deptcode fromm department where deptname = "PM"
 ) and pnum in
 (
-  select pnum from class where deptcode = "CS" and cnum = 245
-) having count(distinct term) = 1
+  select pnum from class where deptcode = "CS" and cnum = 245 and term = 1185
+) and pnum not in
+(
+  select pnum from class where deptcode = "CS" and cnum = 245 and term != 1185
+)
 
 /*
 The number, name and year of each student who has obtained a grade in
@@ -77,7 +86,6 @@ as well as the identifying attributes for each class.
 */
 
 
-
 /*
 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