Created
March 6, 2014 04:04
-
-
Save JALsnipe/44575dc33fcbbb950dcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT cno, dname, b.count_of_students | |
FROM | |
(SELECT COUNT(*) AS num_of_students | |
FROM student s, enroll e | |
WHERE s.sid = e.sid) a, | |
( | |
SELECT c.cno, c.dname, COUNT(*) as count_of_students | |
FROM course c RIGHT OUTER JOIN enroll e | |
ON c.cno = e.cno | |
WHERE c.cno = e.cno AND c.dname = e.dname | |
GROUP BY c.cno, c.dname) b | |
WHERE b.count_of_students < 0.08 * a.num_of_students |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment