当前位置:Gxlcms > 数据库问题 > MySQL查询之聚合查询

MySQL查询之聚合查询

时间:2021-07-01 10:21:17 帮助过:19人阅读

count(*) from students;

2. max(列)表示求此列的最大值

查询女生的编号最大值

select max(id) from students where gender=0;

3. min(列)表示求此列的最小值

查询未删除的学生最小编号

select min(id) from students where isdelete=0;

4. sum(列)表示求此列的和

查询男生的编号之后

select sum(id) from students where gender=1;

5. avg(列)表示求此列的平均值

查询未删除女生的编号平均值

select avg(id) from students where isdelete=0 and gender=0;

 

MySQL查询之聚合查询

标签:总数   style   平均值   where   let   bsp   编号   class   相同   

人气教程排行