当前位置:网站首页>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;
边栏推荐
猜你喜欢
随机推荐
轻量级计划服务工具研发与实践
SQL调优小记
06个人研发的产品及推广-代码统计工具
Yum install XXX reports an error
沉淀下来的数据库操作类-C#版(SQL Server)
Ruoyi-Cloud 踩坑的BUG
[reverse intermediate] eager to try
Logical operation instruction
Akamai浅谈风控原理与解决方案
Interpretation of Flink source code (III): Interpretation of executiongraph source code
Assembly language segment definition
自动答题 之 Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
MySQL optimization notes
05个人研发的产品及推广-数据同步工具
Redis quick start
Ce n'est qu'en apprenant que c est à la hauteur des attentes Top5 s1e8 | s1e9: caractères et chaînes & opérateurs arithmétiques
Only learning C can live up to expectations top2 P1 variable
Von Neumann architecture
唯有学C不负众望 TOP4 S1E6:数据类型
JVM之垃圾回收器上篇









