排除分组结果-SQL语言基础

时间:2024-05-15 13:25:00
【文件属性】:

文件名称:排除分组结果-SQL语言基础

文件大小:5.26MB

文件格式:PPT

更新时间:2024-05-15 13:25:00

SQL 基础

排除分组结果 * 每组中最多薪水大 于$2900的部门号” EMP DEPTNO SAL ------ -------- 10 2450 10 5000 10 1300 20 800 20 1100 20 3000 20 3000 20 2975 30 1600 30 2850 30 1250 30 950 30 1500 30 1250 DEPTNO MAX(SAL) ------- -------- 10 5000 20 3000 5000 3000 2850 * Restricting Group Results In the same way that you use the WHERE clause to restrict the rows that you select, you use the HAVING clause to restrict groups. To find the maximum salary of each department, but show only the departments that have a maximum salary of more than $2900, you need to do the following: Find the average salary for each department by grouping by department number. Restrict the groups to those departments with a maximum salary greater than $2900.


网友评论