当前位置:网站首页>Total / statistics function of MySQL
Total / statistics function of MySQL
2022-07-06 17:25:00 【Cute new vegetable dog】
total / Statistical function
count function
select count(*) from student;
select count(*) from student where math > 90;
- count(*) and count( Column ) The difference between
- count(*) Return the number of rows of records that meet the conditions
- count( Column ) Count the number of columns that meet the conditions , But it will be excluded as null
sum function
- sum Functions only work with numbers , Otherwise, an error will be reported
- For multi column summation , It can't be less .
-- Count the total score of mathematics in a class
select sum(math) from student;
-- Count the total score of each subject in a class
select sum(english),sum(math),sum(chinese) from student;
-- Count the total scores of three subjects in a class
select sum(english+math+chinese) from student;
-- The average score of a Chinese class is one
select sum(chinese) / count(*) from student;
avg function
-- Average score of Statistical Mathematics
select avg(math) from student;
-- Average score of statistical total score
select avg(math + english + chinese) from student;
max/min function
-- Ask for the highest and lowest score of the class
select max(math + english + chinese) , min(math + chinese + english) from student;
-- Seek the highest and lowest scores in class mathematics
select max(math),min(math) from student;
边栏推荐
猜你喜欢

吴军三部曲见识(五) 拒绝伪工作者

Wu Jun's trilogy insight (V) refusing fake workers

Compile homework after class

MySQL optimization notes

JVM之垃圾回收器上篇

Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
![Case: check the empty field [annotation + reflection + custom exception]](/img/50/47cb40e6236a0ba34362cdbf883205.png)
Case: check the empty field [annotation + reflection + custom exception]

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

Logical operation instruction

肖申克的救赎有感
随机推荐
JVM class loading subsystem
一个数10年工作经验的微服务架构老师的简历
Data transfer instruction
04个人研发的产品及推广-数据推送工具
MySQL数字函数
Alibaba cloud server docker installation mysql5.5
Prototype chain inheritance
Program counter of JVM runtime data area
Log4j2 major vulnerabilities and Solutions
Programmer orientation problem solving methodology
信息与网络安全期末复习(基于老师给的重点)
JVM garbage collector part 1
案例:检查空字段【注解+反射+自定义异常】
关于Stream和Map的巧用
Only learning C can live up to expectations top5 S1E8 | S1E9: characters and strings & arithmetic operators
03个人研发的产品及推广-计划服务配置器V3.0
Von Neumann architecture
關於Stream和Map的巧用
8086 segmentation technology
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.