group by是什么意思

在SQL中,group by说是分组的,具体是怎么用呢。最好举个例子

是一分分组语句,比如一个成绩表(Student):(学生姓名,课程名,成绩)name course score张三 Java 90张三 C# 98李四 Java 89李四 C# 62李四 C++ 80 SQL语句:select sum(score) from Student group by course则就是分别对各个课程求总和,就是Java:98+89C#:98+62C++:80SQL语句:select sum(score) from Student group by name则是按人进行分组:张三:90+98李四:89+62+80
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2019-11-12
group by的中文翻译是分组依据。
拓展资料
1,Any such groupings are listed in the GROUP_BY attribute of the root element.
所有这样的分组都在根元素的GROUP BY属性中列出。
2,This operator also serves as input to the Group By operator.
该操作符还充当Group By操作符的输入。
3,Complete the following steps to create and program the Group By operator.
完成以下步骤,创建Group By操作符并对它进行配置。
4,With the appropriate access path, the ORDER BY or GROUP BY requirement can be met without sorting.
使用恰当的访问路径,无需排序即可满足ORDER BY或GROUP BY需求。
5,Drag it to the right of the Group By operator.
将它拖放到Group By操作符的右边。本回答被网友采纳
第2个回答  推荐于2019-08-03
group by是小组通过,分组依据的意思。group的意思是:组,团体,群,批,(雕塑等的)群像,(英美的)空军大队。使成群,集合。分类,归类。
拓展资料
group by的具体用法如下:
1、It can improve performance if columns involved in ORDER BY and GROUP BY are indexed.
如果为ORDER BY和GROUP BY所涉及的列建立了索引,那么可以提高性能。
2、The attributes appear in both the SELECT clause and the GROUP BY clause.
这些属性出现在SELECT子句和GROUP BY子句中。
3、Any such groupings are listed in the GROUP_BY attribute of the root element.
所有这样的分组都在根元素的GROUP BY属性中列出。
4、This operator also serves as input to the Group By operator.
该操作符还充当Group By操作符的输入。
5、Complete the following steps to create and program the Group By operator.
完成以下步骤,创建Group By操作符并对它进行配置。
6、With the appropriate access path, the ORDER BY or GROUP BY requirement can be met without sorting.
使用恰当的访问路径,无需排序即可满足ORDER BY或GROUP BY需求。
7、Drag it to the right of the Group By operator.
将它拖放到Group By操作符的右边。
8、Multiple slices of data can be returned in a single query by using grouping sets or super-groups ( such as ROLLUP) in the GROUP-BY clause of the SQL statement.
通过在SQL语句的GROUP BY子句中使用多个分组集或超级组(比如ROLLUP),可以在一个查询中返回数据的多个切片。本回答被网友采纳
相似回答