elena1234

Salary higher than the average salary (T-SQL)

Jan 5th, 2022 (edited)
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.25 KB | None | 0 0
  1. SELECT TOP (10) FirstName, LastName, DepartmentID FROM Employees AS e1
  2. WHERE Salary > (SELECT AVG(Salary)
  3.                FROM Employees AS e2
  4.                WHERE e1.DepartmentID = e2.DepartmentID
  5.                GROUP BY DepartmentID)
  6.                ORDER BY DepartmentID;
  7.  
Add Comment
Please, Sign In to add comment