请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册
  • 便民服务
  • 关注我们
  • 社区新手
接上篇
4、select * from student order by math desc/sak
5、聚合函数
(1)select count(id) from student
select count(*) from student
(2)select sum/avg(math) from student
(3)select max/min(math) from student
(4)select distinct(sex) from student

6、查询每个班级的数学总成绩
select sum(math) from student group by class

查询每个班数学总分大于100分的班级和总分数
select class,sum(math) from math group by class having sum(math)>100

查询每个班级性别为1的数学总分大于100的班级和总分数
select class,sum(math) from student where sex=1 group by class having sum(math)>100
分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册