×

Loading...

the whole question is for each department, get the average salary of emloyees who have higher salaries than the average salary of the department

ely (Ely)
so the answer should be:

SELECT A.DEPTNAME, AVG(A.EMPSALARY)
FROM EMP A
WHERE A.EMPSALARY > (SELECT AVG(B.EMPSALARY)
FROM EMPLOYEE B
GROUP BY B.DEPTNAME
WHERE B.DEPTNAME = A.DEPTNAME )
GROUP BY A.DEPTNAME

IS IT RIGHT?
i HAVE NO SQL AT HOME...
(#28853@0)
2001-2-27 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: help! SQL assignment due tomorrow...

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论