Преглед на файлове

did another question, in theory

tarfeef101 преди 6 години
родител
ревизия
886375b1eb
променени са 1 файла, в които са добавени 2 реда и са изтрити 6 реда
  1. 2 6
      a2/a2.sql

+ 2 - 6
a2/a2.sql

@@ -124,12 +124,8 @@ The course number and total enrollment count for all of its classes of each
 course. Also, include only those course numbers for courses with a total
 enrollment count among the three lowest such counts.
 */
-select course.cnum, count(class) from course, class, where count(class)
-
-
-
-select course.cnum, 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
+-- Not sure if this will return an error, or 3 rows per old.deptcode, old.cnum since the 3rd parameter (the subquery) has 3 rows
+select old.deptcode, old.cnum, (select count(*) from enrollment where deptcode = old.deptcode and cnum = old.cnum group by deptcode, cnum order by count(*) asc limit 3) from class old
 
 /*
 The percentage of professors in pure math who have always taught no