当前位置:网站首页>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;
边栏推荐
猜你喜欢
1. JVM入门介绍
MySQL date function
Serial serialold parnew of JVM garbage collector
MySQL optimization notes
Interpretation of Flink source code (III): Interpretation of executiongraph source code
ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
Some feelings of brushing leetcode 300+ questions
03个人研发的产品及推广-计划服务配置器V3.0
Introduction to spring trick of ByteDance: senior students, senior students, senior students, and the author "brocade bag"
Assembly language segment definition
随机推荐
Akamai talking about risk control principles and Solutions
06个人研发的产品及推广-代码统计工具
在 vi 编辑器中的命令模式下,删除当前光标处的字符使用 __ 命 令。
JUnit unit test
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
Flink源码解读(二):JobGraph源码解读
Basic knowledge of assembly language
唯有学C不负众望 TOP3 Demo练习
JVM garbage collection overview
03个人研发的产品及推广-计划服务配置器V3.0
Only learning C can live up to expectations TOP4 S1E6: data type
[reverse primary] Unique
Wu Jun's trilogy experience (VII) the essence of Commerce
Idea resolving jar package conflicts
Akamai浅谈风控原理与解决方案
Some feelings of brushing leetcode 300+ questions
MySQL数字函数
唯有学C不负众望 TOP1环境配置
The difference between URI and URL
1. JVM入门介绍