当前位置:网站首页>mysql的合计/统计函数
mysql的合计/统计函数
2022-07-06 09:32:00 【萌新菜狗】
合计/统计函数
count函数
select count(*) from student;
select count(*) from student where math > 90;
- count(*)和count(列)的区别
- count(*)返回满足条件的记录的行数
- count(列)统计满足条件的某列有多少个,但是会排除为null
sum函数
- sum函数仅对数值有作用,否则会报错
- 对于多列求和 , 不能少。
-- 统计一个班级的数学总成绩
select sum(math) from student;
-- 统计一个班级的各科总成绩
select sum(english),sum(math),sum(chinese) from student;
-- 统计一个班级的三科总成绩
select sum(english+math+chinese) from student;
-- 统计一个班级的语文平均分
select sum(chinese) / count(*) from student;
avg函数
-- 统计数学平均分
select avg(math) from student;
-- 统计总成绩平均分
select avg(math + english + chinese) from student;
max/min函数
-- 求班级最高分和最低分
select max(math + english + chinese) , min(math + chinese + english) from student;
-- 求班级数学最高分和最低分
select max(math),min(math) from student;
边栏推荐
- MySQL字符串函数
- README. txt
- 8086 内存
- ByteDance 2022 school recruitment R & D advance approval publicity meeting, students' top 10 issues
- The most lost road I have ever walked through is the brain circuit of ByteDance programmers
- J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets
- ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
- 谢邀,人在工区,刚交代码,在下字节跳动实习生
- Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
- Erlang installation
猜你喜欢
算数运算指令
Alibaba cloud server builds SVN version Library
ByteDance technical Interviewer: what kind of candidate do I want to pick most
TCP's three handshakes and four waves
Alibaba cloud server docker installation mysql5.5
8086 CPU internal structure
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
Shell_ 04_ Shell script
Fdog series (VI): use QT to communicate between the client and the client through the server (less information, recommended Collection)
Activiti目录(四)查询代办/已办、审核
随机推荐
100张图训练1小时,照片风格随意变,文末有Demo试玩|SIGGRAPH 2021
Ruoyi-Cloud 踩坑的BUG
Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]
Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
High performance mysql (Third Edition) notes
Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
Prototype chain inheritance
IDEA断点调试技巧,多张动图包教包会。
Activiti目录(四)查询代办/已办、审核
Fdog series (I): think about it. It's better to write a chat software. Then start with the imitation QQ registration page.
肖申克的救赎有感
谢邀,人在工区,刚交代码,在下字节跳动实习生
Assembly language segment definition
JVM之垃圾回收器下篇
Logical operation instruction
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
学习投资大师的智慧
Eureka single machine construction
Koa Middleware