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 -05:00

回到话题: help! SQL assignment due tomorrow...

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=28853