| id | name | groups | student |
| id | score | class | score |
| 1 | 刘备 | A |
| 2 | 关羽 | A |
| 3 | 张飞 | A |
| 4 | 赵云 | B |
| 5 | 马超 | B |
| 6 | 黄忠 | C |
| 1 | 100 | A |
| 2 | 90 | A |
| 3 | 90 | A |
| 4 | 80 | B |
| 5 | 70 | B |
| 6 | 60 | C |
查询每组,每班的平均成绩 select s.groups,class,avg(score) from score sc join student s on sc.id=s.id group by s.groups, class;
查询成绩前三名的学生,成绩相同随机取名字 select * from score sc join student s on sc.id=s.id group by score order by score desc limit 3;
随时随地看视频