时间:2021-07-01 10:21:17 帮助过:5人阅读
1、最大的id
1 use school;
2 select max(id) from tb_student;
1、最小id
use school;
select min(id) from tb_student;
1、求出所有学生的年龄和
use school;
select sum(age) from tb_student;
1、求所有学生的年龄平均值
use school;
select avg(age) from tb_student;
celing翻译过来就是“天花板”的意思,意思就是,不管小数点后面是什么,就往上进位。比如上面的年龄平均值
use school;
select ceiling(avg(age)) from tb_student;
当然和天花板对应的还有floor函数,当然意思就是相反的了。
use school;
select floor(avg(age)) from tb_student;
mysql之count,max,min,sum,avg,celing,floor
标签: