当前位置:网站首页>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;
边栏推荐
- Notes on how the network is connected
- Junit单元测试
- Final review of information and network security (based on the key points given by the teacher)
- MySQL字符串函数
- 【MMdetection】一文解决安装问题
- JVM垃圾回收概述
- Only learning C can live up to expectations TOP4 S1E6: data type
- 1. Introduction to JVM
- 一个数10年工作经验的微服务架构老师的简历
- Prototype chain inheritance
猜你喜欢
Eight part essay that everyone likes
Activiti目录(四)查询代办/已办、审核
ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
Alibaba cloud server builds SVN version Library
Mongodb learning notes
High performance mysql (Third Edition) notes
JVM 垃圾回收器之Garbage First
Flink 解析(一):基础概念解析
06个人研发的产品及推广-代码统计工具
Notes on how the network is connected
随机推荐
Take you hand-in-hand to do intensive learning experiments -- knock the level in detail
JVM 垃圾回收器之Serial SerialOld ParNew
CentOS7上Redis安装
Redis quick start
JVM垃圾回收概述
Interpretation of Flink source code (III): Interpretation of executiongraph source code
8086 memory
肖申克的救赎有感
CTF逆向入门题——掷骰子
Alibaba cloud server builds SVN version Library
Activiti目录(四)查询代办/已办、审核
DOS function call
Activit fragmented deadly pit
8086 内存
Activiti目录(一)重点介绍
Flink 解析(四):恢复机制
Logical operation instruction
Wu Jun's trilogy insight (V) refusing fake workers
Install docker under windows10 (through Oracle VM VirtualBox)
List集合数据移除(List.subList.clear)