mysql 查询之聚合查询

聚合查询

常用的聚合查询有:sum() avg() max() min() count()

需求:查询学生的math的总成绩(sun()求和函数)

select sum (math)as ‘math的总成绩’from result;

查询 math 的平均分

select avg(math) as 'math的平均分'from result;

 

 select max(math)as'math的最高分'from result;

最低分同上

统计学生学生的个数

 select count(id)as'学生的个数'from student;

 

posted @ 2018-09-20 21:19  秦明科  阅读(1999)  评论(0编辑  收藏  举报