Created
March 6, 2014 03:10
-
-
Save JALsnipe/2f87631cac253afe536b 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 s.sid, s.sname, m.dname, s.gpa, e.dname, e.cno, e.grade | |
FROM student s, enroll e, major m | |
WHERE s.sid = e.sid AND s.sid = m.sid AND | |
(SELECT AVG(e1.grade) | |
FROM enroll e1 | |
WHERE s.sid = e1.sid AND e1.dname in ( | |
SELECT m1.dname | |
FROM major m1 | |
WHERE s.sid = m1.sid)) < | |
(SELECT AVG(e2.grade) | |
FROM enroll e2 | |
WHERE s.sid = e2.sid AND e2.dname NOT IN ( | |
SELECT m2.dname | |
FROM major m2 | |
WHERE s.sid = m2.sid)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment