order by 和 group by 的区别

如题所述

在计算机中:
order by 从英文里理解就是行的排序方式,默认的为升序。 order by
后面必须列出排序的字段名,可以是多个字段名。

group by
从英文里理解就是分组。必须有“聚合函数”来配合才能使用,使用时至少需要一个分组标志字段。
作为英语:
order by 排序;排序依据;分组排序
例句:
1.An index will be used for both an ascending and a descending ORDER BY,whether the index was ascending or descending.
不管索引是升序排列还是降序排列,在执行升序或降序ORDERBY操作时都会使用索引。

2.Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause.
除了ORDERBY(按…排序)语句外,分析函数是一条查询被执行的操作。

group by分组;将表按行分组;分组依据
例句:
1.The List To Group projection can only be used for lists, and it turns the list into agroup by retaining only the first item of the list.
ListToGroup映射仅可用于列表,它通过仅保留列表的第一个项目将列表转化成一个组。

2.Indicates that the data column is being used to create a grouped result set (ispart of a GROUP BY clause) in an aggregate query.
表示数据列用于在聚合查询中创建分组的结果集(GROUPBY子句的一部分)。
温馨提示:答案为网友推荐,仅供参考