0
点赞
收藏
分享

微信扫一扫

SQL语句多表查询:取每位同学各门课的平均成绩,显示成绩前三名的同学的姓名和平均成绩

Java架构领域 2022-02-05 阅读 82
linux运维
MariaDB [hellodb]> select name,avg(score) from students as st,scores as sc,courses as co where st.stuid=sc.stuid and sc.courseid=co.courseid group by st.name order by avg(score) desc limit 3;
+-------------+------------+
| name        | avg(score) |
+-------------+------------+
| Shi Qing    |    96.0000 |
| Shi Zhongyu |    85.0000 |
| Xi Ren      |    84.5000 |
+-------------+------------+
举报

相关推荐

0 条评论