有三个表:
学生表:student 字段:stuID,name,gender,scholarship
成绩表:grade 字段:graID,stuID,courceID,grade
课程表:cource 字段:courceID,courceName,credits
求:查询所有课程分数都在90分以上的学生的stuID,name
select stuID, name
from student
where stuID in
(
select stuID from (
select count(1) cnt, stuID
from grade
where gade > 90
group by stuID
) where cnt =(select count(1) from course)
)
or
select * from student where stuid not in (select distinct stuid from grade where grade < 90)