为了快速获得统计数据,提供了5个聚合函数:函数
查询学生总数spa
select count(*) from students;
查询女生的编号最大值code
select max(id) from students where gender=0;
查询未删除的学生最小编号blog
select min(id) from students where isdelete=0;
查询男生的编号之和class
select sum(id) from students where gender=1;
查询未删除女生的编号平均值select
select avg(id) from students where isdelete=0 and gender=0;