当前位置:网站首页>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;
边栏推荐
- "One year after graduation, I won ACL best paper"
- 这群程序员中的「广告狂人」,把抖音广告做成了AR游戏
- Flink 解析(六):Savepoints
- MySQL字符串函数
- 字节跳动技术面试官现身说法:我最想pick什么样的候选人
- 逻辑运算指令
- 吴军三部曲见识(四) 大家智慧
- 唯有学C不负众望 TOP4 S1E6:数据类型
- Go language uses the thrift protocol to realize the client and service end reports not enough arguments in call to oprot Writemessagebegin error resolution
- Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021
猜你喜欢

ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items

Shell_ 02_ Text three swordsman
![[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.](/img/ef/2072aac5f85c7daf39174784dec7ee.jpg)
[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.

When it comes to Google i/o, this is how ByteDance is applied to flutter

程序员定位解决问题方法论

学习投资大师的智慧

Activiti目录(四)查询代办/已办、审核

搭建flutter环境入坑集合

The most lost road I have ever walked through is the brain circuit of ByteDance programmers

Alibaba cloud server builds SVN version Library
随机推荐
Shell_ 03_ environment variable
Install docker under windows10 (through Oracle VM VirtualBox)
Some instructions on whether to call destructor when QT window closes and application stops
我走過最迷的路,是字節跳動程序員的腦回路
js垃圾回收机制和内存泄漏
8086 memory
README. txt
字节跳动海外技术团队再夺冠:高清视频编码已获17项第一
学习投资大师的智慧
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
Data transfer instruction
Flink parsing (VI): savepoints
唯有学C不负众望 TOP1环境配置
MySQL digital function
Activit fragmented deadly pit
Shell_ 05_ operator
MySQL string function
姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
arithmetic operation
After the subscript is used to assign a value to the string type, the cout output variable is empty.