---
title: "Discussion on \"MySQL | 分组查询的应用\" | Hashnode"
description: "Discussion on \"MySQL | 分组查询的应用\". 数据操作语言：分组查询\n为什么要分组？\n\n默认情况下汇总函数是对全表范围内的数据做统计\nGROUP BY 子句的作用是通过一定的规则将一个数据集划分成若干个小的区域，然后针对每个小区域分别进行数据汇总处理\n\nSELECT deptno,AVG(sal) FROM t_emp\nGROUP BY deptno;\n\nSELECT deptno,ROUND(AVG(sal)) FROM t_emp\nGROUP BY deptno;\n-- ROUND 取整\n\n逐级分组\n\n数据库支持多列分组条件，执行的时候..."
url: "https://hashnode.com/posts/mysql-or-fen-zu-cha-xun-de-ying-yong/628d947bb4bd016fc9a32998"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [MySQL | 分组查询的应用](https://hn.icodeq.com/mysql-or-fen-zu-cha-xun-de-ying-yong?utm_source=hashnode&utm_medium=feed)

数据操作语言：分组查询 为什么要分组？ 默认情况下汇总函数是对全表范围内的数据做统计 GROUP BY 子句的作用是通过一定的规则将一个数据集划分成若干个小的区域，然后针对每个小区域分别进行数据汇总处理 SELECT deptno,AVG(sal) FROM t\_emp GROUP BY deptno; SELECT deptno,ROUND(AVG(sal)) FROM t\_emp GROUP BY deptno; -- ROUND 取整 逐级分组 数据库支持多列分组条件，执行的时候...

Apr 27, 2022 · 1 min read · hn.icodeq.com  
Read the article

## Written by

[zhou keqiang](https://hashnode.com/@zkeq)

@zkeq

  
[View profile](https://hashnode.com/@zkeq)

Creating And Studying .

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
