当前位置:网站首页>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 .
边栏推荐
- [combinatorics] recursive equation (solution of linear non-homogeneous recursive equation with constant coefficients | standard form and general solution of recursive equation | proof of general solut
- PHP returns 500 errors but no error log - PHP return 500 error but no error log
- Swm32 series Tutorial 4 port mapping and serial port application
- Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
- Vs code plug-in korofileheader
- 基于主机的入侵系统IDS
- [mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
- [RT thread] NXP rt10xx device driver framework -- RTC construction and use
- Kubernetes resource object introduction and common commands (III)
- Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
猜你喜欢
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
Wechat applet for the first time
How to train mask r-cnn model with your own data
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
QT adjust win screen brightness and sound size
[RT thread] NXP rt10xx device driver framework -- RTC construction and use
POM in idea XML graying solution
Notes on problems -- watching videos on edge will make the screen green
随机推荐
Kotlin学习快速入门(7)——扩展的妙用
Host based intrusion system IDS
Rsync remote synchronization
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
1146_ SiCp learning notes_ exponentiation
IntelliJ 2021.3 short command line when running applications
Unity notes unityxr simple to use
[combinatorics] recursive equation (solution of linear non-homogeneous recursive equation with constant coefficients | standard form and general solution of recursive equation | proof of general solut
Kotlin learning quick start (7) -- wonderful use of expansion
QT adjust win screen brightness and sound size
vs code 插件 koroFileHeader
Kubernetes resource object introduction and common commands (4)
Redis: operation commands for list type data
Test your trained model
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
Implementation of Tetris in C language
How to purchase Google colab members in China
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
Design e-commerce spike
Kubernetes resource object introduction and common commands (III)