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

mysql中order by与group by的区别_MySQL

WBOY
WBOYOriginal
2016-06-01 13:25:171593browse

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

Statement:
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