+ 2
Solve the query
for each department that has more than 5 employee. retrieve dept no and number of employees who have salary more than 5000
2 Antworten
+ 1
select DEPARTMENT,count(STAFF_ID) as CountStaff, avg(SALARY) as AVGSalary
from STAFF
group by DEPARTMENT
having count(Salary) > 5000
+ 1
SELECT D.Dpt_Name, COUNT(E.EmpId) AS NumberOfOrders, Max(E.Salary) as Salary FROM Department
INNER JOIN Employees
ON E.Dpt_Id=D.DptId
GROUP BY D.Dpt_Name
HAVING Max(Salary) > 5000