当前位置:网站首页>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

边栏推荐
- Summary of June 2022
- Splicing plain text into JSON strings - easy language method
- Vulhub vulnerability recurrence 76_ XXL-JOB
- tars源码分析之7
- selenium驱动IE常见问题解决Message: Currently focused window has been closed.
- Adaptive spatiotemporal fusion of multi-target networks for compressed video perception enhancement
- 期末周,我裂开
- Shopping malls, storerooms, flat display, user-defined maps can also be played like this!
- [Mori city] random talk on GIS data (I)
- 在已經知道錶格列勾選一個顯示一列
猜你喜欢

响应式移动Web测试题

响应式——媒体查询

MySQL 45 lecture learning notes (VII) line lock

Uniapp applet subcontracting

Responsive - media query

【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真

关于IDEA如何设置快捷键集

MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0

Introduction to spark core components

Chain ide -- the infrastructure of the metauniverse
随机推荐
Tar source code analysis 9
Tar source code analysis Part 3
2022年,或許是未來10年經濟最好的一年,2022年你畢業了嗎?畢業後是怎麼計劃的?
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
[GF (q) + LDPC] regular LDPC coding and decoding design and MATLAB simulation based on the GF (q) field of binary graph
Industrial computer anti-virus
How to buy financial products in 2022?
关于IDEA如何设置快捷键集
云Redis 有什么用? 云redis怎么用?
Finishing (III) - Exercise 2
Selenium driver ie common problem solving message: currently focused window has been closed
Analysis of tars source code 1
《剑指Offer》第2版——力扣刷题
Latex中的单引号,双引号如何输入?
A new understanding of how to encrypt industrial computers: host reinforcement application
Selection (022) - what is the output of the following code?
输入年份、月份,确定天数
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
【FreeRTOS】FreeRTOS学习笔记(7)— 手写FreeRTOS双向链表/源码分析
MySQL 45 learning notes (XI) how to index string fields