ROUND(AVG(Salary) OVER (PARTITION BY Department), 2) AS DeptAvgSalary, ROUND(Salary - AVG(Salary) OVER (PARTITION BY Department), 2) AS DiffFromAvg ...
--windows functions are really powerful and are somewhat like a group by - except they don't roll everything up into 1 row when grouping. --windows functions allow us to look at a partition or a group ...