Highest Average Salary

Construct a query which finds the job with the highest average salary

Questions by shameem_chandu

Showing Answers 1 - 12 of 12 Answers

taaznyonker

  • Mar 31st, 2010
 

If you want to get only highest average salary of particular dept, then you can use

SELECT MAX(AVG(sal)) FROM emp GROUP BY deptno

and if want the dept number too, with the average sal, then query ould look like:

SELECT deptno, AVG(sal)
FROM emp
GROUP BY deptno
HAVING AVG(sal) = (SELECT MAX(AVG(sal)) FROM emp GROUP BY deptno)

Shubham kumar

  • Oct 21st, 2021
 

Hope, This Will Help

Code
  1. SELECT AVG(sal) FROM emp

  2.  GROUP BY job_id

  3. ORDER BY AVG(sal) LIMIT 1;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions