mysql> select sname from student,sc where student.sno=sc.sno and sc.sno not in (select r.sno from (select sno,score from sc,course where sc.cno=course.cno and course.cname='数据库') AS r INNER JOIN(select sno,avg(score) avg_grade FROM sc group by sno) AS t ON r.sno=t.sno and r.score<t.avg_grade);
3 回答
已采纳
一瞬儿光
TA贡献178条经验 获得超70个赞
SELECT sname FROM student WHERE sno in(SELECT sno FROM sc WHERE score >= (SELECT avg(`score`) FROM sc GROUP BY (SELECT cno FROM course WHERE cname='数据库')));
一瞬儿光
TA贡献178条经验 获得超70个赞
SELECT sname from student WHERE sno in(select temp.sno FROM (select sno,avg(score) as avgs FROM sc GROUP BY sno) as temp where temp.sno in(SELECT sc.sno from sc where sc.sno=temp.sno and sc.cno=(SELECT course.cno from course WHERE cname='数据库') and sc.score>=temp.avgs));
你的表述就有问题,还0分,无语!!!这会再试试吧
侠客岛的含笑
TA贡献552条经验 获得超285个赞
SELECT sname FROM student WHERE sno in(SELECT sno FROM sc WHERE cno=(SELECT cno FROM course WHERE cname='数据库') and score>=(SELECT avg(`score`) FROM sc group BY sno));
添加回答
举报
0/150
提交
取消