mysql查询数据库的成绩高于其平均成绩的学生的姓名?写出打部分来了,但是
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 |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
SELECTsnameFROMstudentWHEREsnoin(SELECTsnoFROMscWHEREscore>=(SELECTavg(`score`)FROMscGROUPBY(SELECTcnoFROMcourseWHEREcname='数据库'))); |
|
|
|
|
SELECTsnamefromstudentWHEREsnoin(selecttemp.snoFROM(selectsno,avg(score)asavgsFROMscGROUPBYsno)astempwheretemp.snoin(SELECTsc.snofromscwheresc.sno=temp.snoandsc.cno=(SELECTcourse.cnofromcourseWHEREcname='数据库')andsc.score>=temp.avgs));你的表述就有问题,还0分,无语!!!这会再试试吧 |
|
|
|
|