在jennifer widom的dbclass中,她举了一个例子,让大学与申请人的最高gpa配对.sql在下面
select college.cname, state, gpa
from college, apply, student
where college.cname = apply.cname
and apply.sid = student.sid
and gpa >= all (select gpa
from student,apply
where student.sid = apply.sid
and apply.cname = college.cname);
我想知道如何创建查询以查找与最低 gpa申请人配对的大学
我知道这可以按照以下方式完成
select college.cname, state, gpa
from college, apply, student
where college.cname = apply.cname
and apply.sid = student.sid
and gpa = (select min(gpa) from student);
但我该如何做,不使用min ?
答案 0 :(得分:0)
select college.cname,state,gpa
from college c
join apply a On a.cname = c.cname
join student s On s.sid = apply.sid
where Not exists(select * from student
Where gpa < s.gpa);