GeekInterview.com
Series: Subject: Topic:
Question: 58 of 429

Highest Average Salary

Construct a query which finds the job with the highest average salary
Asked by: shameem_chandu | Member Since Oct-2009 | Asked on: Oct 20th, 2009

View all questions by shameem_chandu

Showing Answers 1 - 3 of 3 Answers
deeprashi

Answered On : Mar 1st, 2010

View all answers by deeprashi

SELECT max(sal), job FROM emp GROUP BY job

  
Login to rate this answer.

SELECT MAX(AVG(salary)) FROM employee GROUP BY emp_id

  
Login to rate this answer.
taaznyonker

Answered On : Mar 31st, 2010

View all answers by taaznyonker

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)

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.