Home > Database > Mysql Tutorial > mysql中order by与group by的区别

mysql中order by与group by的区别

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:17:07
Original
2196 people have browsed it

以下是对mysql中order by与group by的区别进行了详细的分析介绍,需要的朋友可以过来参考下 order by 从英文里理解就是行的排序方式,默认的为升序。 order by 后面必须列出排序的字段名,可以是多个字段名。 group by 从英文里理解就是分组。必须有聚合函数

以下是对mysql中order by与group by的区别进行了详细的分析介绍,需要的朋友可以过来参考下

 

order by 从英文里理解就是行的排序方式,,默认的为升序。 order by 后面必须列出排序的字段名,可以是多个字段名。     
group by 从英文里理解就是分组。必须有“聚合函数”来配合才能使用,使用时至少需要一个分组标志字段。 
什么是“聚合函数”? 
像sum()、count()、avg()等都是“聚合函数” 
使用group by 的目的就是要将数据分类汇总。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template