在GROUP BY和ORDER BY之间的区别是什么 [英] what is the difference between GROUP BY and ORDER BY in sql

查看:477
本文介绍了在GROUP BY和ORDER BY之间的区别是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你什么时候使用它一般?例如非常鼓励!



我指的是MySql,但不能想象另一个DBMS上的概念是不同的



GROUP BY将根据指定的列汇总记录,允许您可以对非分组列(例如SUM,COUNT,AVG等)执行聚合函数。


When do you use which in general? Examples are highly encouraged!

I am referring so MySql, but can't imagine the concept being different on another DBMS

解决方案

ORDER BY alters the order in which items are returned.

GROUP BY will aggregate records by the specified columns which allows you to perform aggregation functions on non-grouped columns (such as SUM, COUNT, AVG, etc).

这篇关于在GROUP BY和ORDER BY之间的区别是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆