MySQL 查询表中平均分最低的班级

数据库评论411字数 64阅读模式

查询出dd(user_id,class_no,score)这个表中平均分最低的班级

  1. drop table if exists dd;
  2. create table dd (
  3. user_id int ,
  4. class_no int ,
  5. score int
  6. );
  7. insert into dd values (1,1,1), (2,1,1), (3,1,2), (4,2,2);
  8. select class_no ,avg(score)from dd group by class_no order by avg(score);

MySQL下面测试通过。很文博客-https://www.zhenjiekeji.com/51510.html

很文博客-https://www.zhenjiekeji.com/51510.html
weinxin
我的微信
微信号已复制
扫一扫更精彩
大家的支持是我更新的动力!!!
匿名

发表评论

匿名网友