- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
The GROUP BY Clause You can use the GROUP BY clause to divide the rows in a table into groups. You can then use the group functions to return summary information for each group. In the syntax: group_by_expression specifies columns whose values determine the basis for grouping rows Guidelines If you include a group function in a SELECT clause, you cannot select individual results as well, unless the individual column appears in the GROUP BY clause. You receive an error message if you fail to include the column list in the GROUP BY clause. Using a WHERE clause, you can exclude rows before dividing them into groups. You must include the columns in the GROUP BY clause. You cannot use a column alias in the GROUP BY clause. By default, rows are sorted by ascending order of the columns included in the GROUP BY list. You can override this by using the ORDER BY clause. The GROUP BY Clause (continued) When using the GROUP BY clause, make sure that all columns in the SELECT list that are not group functions are included in the GROUP BY clause. The example on the slide displays the department number and the average salary for each department. Here is how this SELECT statement, containing a GROUP BY clause, is evaluated: The SELECT clause specifies the columns to be retrieved: Department number column in the EMPLOYEES table The average of all the salaries in the group you specified in the GROUP BY clause The FROM clause specifies the tables that the database must access: the EMPLOYEES table. The WHERE clause specifies the rows to be retrieved. Since there is no WHERE clause, all rows are retrieved by default. The GROUP BY clause specifies how the rows should be grouped. The rows are being grouped by department number, so the AVG function that is being applied to the salary column will calculate the average salary for each department. Instructor Note Group results are sorted implicitly, on the grouping column. You can use ORDER BY to specify a different sort order,
您可能关注的文档
最近下载
- 建筑室内设计专业职业生涯规划.pptx
- 语文古诗:渔家傲和苏幕遮的对比.ppt VIP
- 煤灰分的测定.ppt VIP
- 《照明线路的安装与检修》学习任务设计方案6实训室照明电路的安装学习任务设计方案.doc VIP
- 2024年1月浙江省高三普通高校招生方向性测试物理试题卷含答案.pdf VIP
- 1.3《闪亮的坐标—劳模王进喜》获奖课件.pptx VIP
- 液化石油气管理人员安全考核考试试卷及答案.docx VIP
- 第九讲中国健康生活方式预防心血管代谢疾病指南之合理膳食篇.docx VIP
- 中国的商业与货币经济 (2).pptx
- 植物新品种特异性稳定性一致性测试指引亚麻-农业部植物新品种.pdf VIP
有哪些信誉好的足球投注网站
文档评论(0)