用SQL语句相关子查询实现,查询至少选修了平均成绩大于80分的全部课程的学生的姓名和所在系。
老师给的答案,谢谢各位的回答
select sname,sdept from student s
where not exists( select cno from sc sc1 where
not exists ( select * from sc where cno=sc1.cno and sno=s.sno)
group by cno having avg(grade)>80)
select course.name ,course.department from course ,
(SELECT id, (COURSEA,COURSEB,COURSEC)/3 as course_avg from course )cv
where course.id = cv.id and cv.course_avg >=80
这个问题都没有提清楚,什么叫“查询至少选修了平均成绩大于80分”?
我记得你们其他同学也提过类似的 问题,你可以先搜索一下再来提问。