+ 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

14th Dec 2016, 8:58 AM
Ahamad Irfan
Ahamad Irfan - avatar
2 Antworten
+ 1
select DEPARTMENT,count(STAFF_ID) as CountStaff, avg(SALARY) as AVGSalary from STAFF group by DEPARTMENT having count(Salary) > 5000
14th Dec 2016, 9:14 AM
Akwin Lopez
Akwin Lopez - avatar
+ 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
14th Dec 2016, 9:22 AM
Akwin Lopez
Akwin Lopez - avatar