SQLTeam.com | Weblogs | Forums

Obtaining Top 5 Employees Having Highest Average Salaries and Maximum Salary < 100000

I know that i need to use the AVG() and MAX(). I just dont know where.

My question is asking:

Find the top 5 employees with the greatest average salaries that also have a maximum salary less than 100,000.

I tried this:

SELECT emp_no,
AVG(salary)
FROM salaries
WHERE salary < 100000
GROUP BY emp_no
ORDER BY 2 DESC
LIMIT 5;

is that right answer

thanks

so much

Is this homework?