Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

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

This is a discussion on List all the job groups who average salary exceeds that of managers. within the SQL Server forums, part of the Databases category; 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 ...

Go Back   Geeks Talk > Databases > SQL Server
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

SQL Server SQL Server is a Database Management System(DBMS) by Microsoft

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2009
Junior Member
 
Join Date: Mar 2009
Posts: 22
Thanks: 0
Thanked 1 Time in 1 Post
jaideepu is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-28-2009
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,853
Thanks: 9
Thanked 168 Times in 142 Posts
debasisdas has a spectacular aura aboutdebasisdas has a spectacular aura about
Re: List all the job groups who average salary exceeds that of managers.

What is the code that you are working on ?
Reply With Quote
  #3 (permalink)  
Old 04-29-2009
Contributing Member
 
Join Date: Jun 2007
Location: Delhi, India
Posts: 63
Thanks: 0
Thanked 25 Times in 21 Posts
vikasvaidya is on a distinguished road
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
Reply With Quote
  #4 (permalink)  
Old 06-26-2009
Junior Member
 
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Saakha is on a distinguished road
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.
Reply With Quote
  #5 (permalink)  
Old 06-26-2009
Junior Member
 
Join Date: Jan 2008
Location: chennai
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
r.kothandaraman is on a distinguished road
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;
Reply With Quote
  #6 (permalink)  
Old 06-26-2009
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 515
Thanks: 29
Thanked 63 Times in 61 Posts
susarlasireesha will become famous soon enough
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
Reply With Quote
  #7 (permalink)  
Old 06-27-2009
Contributing Member
 
Join Date: Jun 2009
Location: United States
Posts: 71
Thanks: 0
Thanked 5 Times in 4 Posts
CSOOR is on a distinguished road
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" )
Reply With Quote
Reply

  Geeks Talk > Databases > SQL Server

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to display 3rd highest salary to 5th highest salary from emp table kirandstyle SQL 4 02-18-2009 09:22 AM
what s da manager of managers out of concurrent managers sudhakar83.p Oracle 1 07-16-2008 09:42 AM
Average Salary smart_coder Brainteasers 3 11-03-2007 11:29 AM
what is the average speed ? psuresh1982 Brainteasers 4 01-04-2007 04:51 AM
what is the average speed? psuresh1982 Brainteasers 2 11-28-2006 08:27 AM


All times are GMT -4. The time now is 04:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved