Results 1 to 7 of 7

Thread: List all the job groups who average salary exceeds that of managers.

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Answers
    22

    List all the job groups who average salary exceeds that of managers.

    List all the job groups who average salary exceeds that of managers.

    Empno ename job manager hiredate salary deptno commission
    7369 smith clerk 7902 12/1/1982 1200 20 null
    7499 allen salesman 7698 2/20/1981 1501 30 null
    7521 ward salesman 7698 2/22/1981 1600 30 160
    7698 black manager 7999 5/1/1981 3850 30 385
    7902 ford analyst 7566 12/1/1981 3000 10 300
    7688 jones analyst 7698 10/10/2008 4500 10 450
    7689 martin clerk 7698 12/12/2004 4525 20 453
    7999 scott ceo null 1/1/2001 9999 30 1000
    7466 tiger manager 7999 1/1/2004 6500 10 650

    Last edited by debasisdas; 04-28-2009 at 10:58 AM. Reason: formatted

  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: List all the job groups who average salary exceeds that of managers.

    What is the code that you are working on ?


  3. #3
    Contributing Member
    Join Date
    Jun 2007
    Answers
    65

    Re: List all the job groups who average salary exceeds that of managers.

    Hi Jai,

    The query can be like

    Select AvgSal, job from (
    select avg(salary) AvgSal, job from [tablename] group by job
    ) as vw where job<>'manager'
    and AvgSal > (Select Avg(Salary) from [tablename] where job='manager')



    ---V V---
    Vikas Vaidya


  4. #4
    Junior Member
    Join Date
    Jun 2009
    Answers
    1

    Re: List all the job groups who average salary exceeds that of managers.

    Select job,avg(salary)from employees where (avg(salary)>(select salary from employees where job=manager) and job not equals 'manager') group by job.


  5. #5

    Re: List all the job groups who average salary exceeds that of managers.

    Select job,avg(salary)from employees where (avg(salary)>(select salary from employees where job=manager) and job not equals 'manager') group by job;


  6. #6
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: List all the job groups who average salary exceeds that of managers.

    Select job, avgsal
    From (Select Avg (sal) avgsal, job
    From emp
    Group By job),
    (Select sal msal
    From emp
    Where job = 'MANAGER')
    Where avgsal > msal And job != 'MANAGER'

    Sireesha

  7. #7
    Contributing Member
    Join Date
    Jun 2009
    Answers
    76

    Re: List all the job groups who average salary exceeds that of managers.

    select job, avg(sal ) from emp where job != "MANAGER" group by job
    having avg(sal ) > ( select avg(sal) from emp where job = "MANAGER" )


  8.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact