当前位置:网站首页>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;
边栏推荐
- Shell_ 06_ Judgment and circulation
- "One year after graduation, I won ACL best paper"
- 在 vi 编辑器中的命令模式下,删除当前光标处的字符使用 __ 命 令。
- The most lost road I have ever walked through is the brain circuit of ByteDance programmers
- 学习投资大师的智慧
- Resume of a microservice architecture teacher with 10 years of work experience
- @RequestMapping、@GetMapping
- The 116 students spent three days reproducing the ByteDance internal real technology project
- 吴军三部曲见识(五) 拒绝伪工作者
- MySQL digital function
猜你喜欢

ByteDance technical Interviewer: what kind of candidate do I want to pick most

The daemon thread starts redis and modifies the configuration file

Shell_ 07_ Functions and regular expressions

ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021

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

1. JVM入门介绍

吴军三部曲见识(七) 商业的本质

Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment

Error occurred during initialization of VM Could not reserve enough space for object heap

8086 CPU 内部结构
随机推荐
算数运算指令
Some feelings of brushing leetcode 300+ questions
TCP的三次握手和四次挥手
Activiti directory (IV) inquiry agency / done, approved
MySQL string function
手把手带你做强化学习实验--敲级详细
TCP's three handshakes and four waves
Only learning C can live up to expectations top2 P1 variable
Only learning C can live up to expectations Top1 environment configuration
MySQL digital function
JVM之垃圾回收器上篇
When it comes to Google i/o, this is how ByteDance is applied to flutter
@RequestMapping、@GetMapping
Instructions for Redux
Basic knowledge of assembly language
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
字节跳动技术面试官现身说法:我最想pick什么样的候选人
DS18B20数字温度计系统设计
After idea installs the plug-in, restart the plug-in and disappear
Activiti directory (V) reject, restart and cancel process