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

边栏推荐
- Vulhub vulnerability recurrence 77_ zabbix
- Download address of the official website of national economic industry classification gb/t 4754-2017
- MySQL 45 lecture learning notes (XIV) count (*)
- kubernetes集群之Label管理
- Campus network problems
- tornado之目录
- [FPGA tutorial case 7] design and implementation of counter based on Verilog
- Data double write consistency between redis and MySQL
- A new understanding of how to encrypt industrial computers: host reinforcement application
- 抽奖系统测试报告
猜你喜欢

Selenium ide plug-in download, installation and use tutorial

两年前美国芯片扭捏着不卖芯片,如今芯片堆积如山祈求中国帮忙

com. alibaba. nacos. api. exception. NacosException

Deep profile data leakage prevention scheme

用于压缩视频感知增强的多目标网络自适应时空融合

BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment

Node connection MySQL access denied for user 'root' @ 'localhost' (using password: yes

centos8安装mysql.7 无法开机启动

Shopping malls, storerooms, flat display, user-defined maps can also be played like this!
![[network data transmission] FPGA based development of 100M / Gigabit UDP packet sending and receiving system, PC to FPGA](/img/71/1d6179921ae84b1ba61ed094e592ff.png)
[network data transmission] FPGA based development of 100M / Gigabit UDP packet sending and receiving system, PC to FPGA
随机推荐
[Valentine's day] - you can change your love and write down your lover's name
Redis interview question set
云Redis 有什么用? 云redis怎么用?
《国民经济行业分类GB/T 4754—2017》官网下载地址
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Data double write consistency between redis and MySQL
Analysis of tars source code 1
[thread pool]
Set JTAG fuc invalid to normal IO port
Uniapp applet subcontracting
A new understanding of how to encrypt industrial computers: host reinforcement application
Summary of June 2022
Wechat applet scroll view component scrollable view area
What is industrial computer encryption and how to do it
centos8安装mysql.7 无法开机启动
The important role of host reinforcement concept in medical industry
Latex中的单引号,双引号如何输入?
How does the recv of TCP socket receive messages of specified length?
MySQL 45 lecture learning notes (VI) global lock
Computer connects raspberry pie remotely through putty