当前位置:网站首页>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;
边栏推荐
- 8086 CPU internal structure
- Basic knowledge of assembly language
- 面试集锦库
- Assembly language segment definition
- Conception du système de thermomètre numérique DS18B20
- Fdog series (VI): use QT to communicate between the client and the client through the server (less information, recommended Collection)
- Control transfer instruction
- Set up the flutter environment pit collection
- redux使用说明
- ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
猜你喜欢
MySQL string function
Coursera cannot play video
学习投资大师的智慧
Description of project structure configuration of idea
Activit零零碎碎要人命的坑
JVM类加载子系统
Introduction to spring trick of ByteDance: senior students, senior students, senior students, and the author "brocade bag"
Install docker under windows10 (through Oracle VM VirtualBox)
The 116 students spent three days reproducing the ByteDance internal real technology project
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
随机推荐
Idea resolving jar package conflicts
The QT program compiled on CentOS lacks a MySQL driven solution
字节跳动技术面试官现身说法:我最想pick什么样的候选人
Interview collection library
Conception du système de thermomètre numérique DS18B20
Activiti directory (I) highlights
Activiti目录(一)重点介绍
Flink源码解读(三):ExecutionGraph源码解读
我走過最迷的路,是字節跳動程序員的腦回路
Instructions for Redux
Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
arithmetic operation
Koa Middleware
Typescript basic operations
Only learning C can live up to expectations Top1 environment configuration
Flink 解析(六):Savepoints
Only learning C can live up to expectations top2 P1 variable
Prototype chain inheritance
Introduction to spring trick of ByteDance: senior students, senior students, senior students, and the author "brocade bag"
谢邀,人在工区,刚交代码,在下字节跳动实习生