Selaa lähdekoodia

removed some aggregation

tarfeef101 6 vuotta sitten
vanhempi
commit
89e0390cd2
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      a2/a2.sql

+ 6 - 1
a2/a2.sql

@@ -32,7 +32,7 @@ course.
 */
 select distinct snum, sname, year from student where snum in
 (
-  select snum, grade from mark where deptcode = "CS" and cnum = 240 and snum >= (select max(grade) from mark where deptcode = "CS" and cnum = 240)
+  select snum, grade from mark where deptcode = "CS" and cnum = 240 and snum >= (select grade from mark where deptcode = "CS" and cnum = 240 order by grade desc limit 1)
 )
 
 /*
@@ -76,6 +76,8 @@ four values, each result should include the number and name of each professor,
 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
@@ -91,6 +93,9 @@ course. Also, include only those course numbers for courses with a total
 enrollment count among the three lowest such counts.
 */
 
+select course.cname, COUNT() from course, joinedTable
+inner join class on enrollment.deptcode = class.deptcode, enrollment.cnum = class.cnum, enrollment.term = class.term, enrollment.section = class.section as joinedTable
+
 /*
 The percentage of professors in pure math who have always taught no
 more than a single course in any given term. (Note that a percentage