Good Evening Experts,
This is an SQL Query that demonstates using the OVER Clause, used to specify all window functions within SQL Server 2005.
And I am grappling with understanding the 3rd (OVER (PARTITION BY dept_id) max_sal_dept, salary) and 4th lines. I can follow this statement up to (OVER (PARTITION BY dept_id), but what comes next I don't understand. Can someone please explain this to me?
SELECT dept_id, last_name, salary
FROM (SELECT dept_id, last_name, MAX(salary)
OVER (PARTITION BY dept_id) max_sal_dept, salary
FROM employee) AS part_deptid
WHERE salary = max_sal_dept