当前位置:网站首页>SQL foundation 9 [grouping data]
SQL foundation 9 [grouping data]
2022-07-04 07:09:00 【weixin_ forty-five million nine hundred and two thousand and ei】
The data packet
Using grouping, you can divide data into multiple logical groups , And perform aggregation calculation for each group .Create grouping
Grouping is using select Of the statement group by Clause .group by It can be considered as putting the data in a table , According to the value of the grouping field , It is divided into several different sub tables
The meaning of the above sentence : Counter table tb_order Press order_status Grouping , Return to a different order_status, And their number . give the result as follows .
*group by Clause can contain any number of columns , Thus, groups can be nested , More detailed data grouping .
* If in group by Group nested in Clause , The data will be summarized on the last specified group .
*group by Each column listed in clause must be a number of search columns or valid expressions ., If in select Using expressions in , Must be in group by Clause specifies the same expression .
* In addition to aggregate calculation statements ,select Each column in the statement must be in group by Given in Clause .
* If the grouping column null, be null Will be returned as a group .
*group by Clause must appear in where Before clause ,order by After Clause .Filter grouping
Use having Filter groups , All types of where Clause can be used having Instead of , The only difference is ,where Filter line , and having Filter grouping .
*where Filter before data grouping ,having Filter after data grouping ,where Excluded rows are not included in the group .
Enter the following example , Filter out receiver_address For the record of Zhongteng building .Grouping and sorting
order by Sort the resulting output ,group by Group lines , But the output may not be in the order of grouping .select Clause order
边栏推荐
- Tar source code analysis Part 7
- tars源码分析之3
- The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
- MySQL storage engine
- [GF (q) + LDPC] regular LDPC coding and decoding design and MATLAB simulation based on the GF (q) field of binary graph
- The crackdown on Huawei prompted made in China to join forces to fight back, and another enterprise announced to invest 100 billion in R & D
- [Mori city] random talk on GIS data (I)
- 响应式移动Web测试题
- Chain ide -- the infrastructure of the metauniverse
- Shopping malls, storerooms, flat display, user-defined maps can also be played like this!
猜你喜欢
Transition technology from IPv4 to IPv6
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
云Redis 有什么用? 云redis怎么用?
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Uniapp applet subcontracting
用于压缩视频感知增强的多目标网络自适应时空融合
notepad++如何统计单词数量
响应式——媒体查询
The most effective futures trend strategy: futures reverse merchandising
The final week, I split
随机推荐
MySQL storage engine
在已经知道表格列勾选一个显示一列
Set JTAG fuc invalid to normal IO port
Cervical vertebra, beriberi
Mobile adaptation: vw/vh
《国民经济行业分类GB/T 4754—2017》官网下载地址
Campus network problems
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
JS common time processing functions
[FPGA tutorial case 7] design and implementation of counter based on Verilog
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
MySQL 45 lecture learning notes (VI) global lock
Pangu open source: multi support and promotion, the wave of chip industry
【FPGA教程案例7】基于verilog的计数器设计与实现
Responsive - media query
Deep understanding of redis -- a new type of bitmap / hyperloglgo / Geo
Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
电子协会 C语言 1级 35 、银行利息
Vulhub vulnerability recurrence 77_ zabbix
2022年,或許是未來10年經濟最好的一年,2022年你畢業了嗎?畢業後是怎麼計劃的?