I have only 1 table named EMPLOYEE on my database with the 3 following collumns:
Employee_Name, Employee_Salary, Department_ID
Try using EXISTS()
like:
SELECT t1.Employee_Name, t1.Employee_Salary, t1.Department_ID
FROM Employee t1
WHERE EXISTS
(
SELECT t2.Department_ID, AVG(t2.Employee_Salary) as AvgSalary
FROM Employee t2
WHERE t1.Department_ID = t2.Department_ID
GROUP BY t2.Department_ID
HAVING t1.Employee_Salary>AVG(t2.Employee_Salary)
);
See Fiddle Demo