当前位置:网站首页>MySQL grouping query
MySQL grouping query
2022-07-03 17:35:00 【sshi9】
Group query
Group query mainly involves two clauses , Namely :group by and having
group by
Get the total salary of each job , Position name and total salary are required to be displayed

Group the raw data by position department and salary
Raw data

After grouping

having
If you want to filter the grouped data again, you need to use having Clause
The average salary for each position is greater than 2000

Execution order of grouping functions :
1. Query data according to criteria
2. grouping
3. use having Filter , Get the right data
select summary
A complete select The statement format is as follows :
select Field
from Table name
where …….
group by ……..
having …….( It exists to filter the grouped data — It cannot appear alone )
order by ……..
The execution order of the above statements
- First, execute where Statement to filter raw data
- perform group by Grouping
- perform having Operate on grouped data
- perform select Select data
- perform order by Sort
principle : Can be in where Data filtered in , As far as possible in where Medium filtration , More efficient .having The filtering of is dedicated to filtering the data after grouping .
边栏推荐
- LeetCode13.罗马数字转整数(三种解法)
- 鸿蒙第三次培训
- 【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用
- Kotlin学习快速入门(7)——扩展的妙用
- Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
- Managing multiple selections with MVVM - managing multiple selections with MVVM
- Golang unit test, mock test and benchmark test
- ArrayList analysis 3: delete elements
- Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
- Installation and configuration of network hard disk NFS
猜你喜欢

Implementation of Tetris in C language

Unity notes unityxr simple to use

kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)

1147_ Makefile learning_ Target files and dependent files in makefile

Life is still confused? Maybe these subscription numbers have the answers you need!

Leetcode 669 pruning binary search tree -- recursive method and iterative method

IntelliJ 2021.3 short command line when running applications

Leetcode Valentine's Day Special - looking for a single dog

Wechat applet for the first time

TensorBoard快速入门(Pytorch使用TensorBoard)
随机推荐
SWM32系列教程4-端口映射及串口应用
Automata and automatic line of non-standard design
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.
AcWing 4489. Longest subsequence
[combinatorics] recursive equation (general solution structure of recursive equation with multiple roots | linear independent solution | general solution with multiple roots | solution example of recu
Unity notes unityxr simple to use
An example of HP array card troubleshooting
Hongmeng fourth training
How to train mask r-cnn model with your own data
WEB-UI自动化测试-最全元素定位方法
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
Leetcode 669 pruning binary search tree -- recursive method and iterative method
Applet setting multi account debugging
Analyse ArrayList 3: suppression d'éléments
Svn full backup svnadmin hotcopy
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
Brief introduction to the core functions of automatic penetration testing tool
When absolutely positioned, the element is horizontally and vertically centered
[combinatorics] recursive equation (special solution example 1 Hannover tower complete solution process | special solution example 2 special solution processing when the characteristic root is 1)