GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 120 of 171    Print  
How to compare the total salary of all employee with a individual employee salary for a particular department.

  
Total Answers and Comments: 3 Last Update: June 06, 2009     Asked by: c.p.mohan 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: arun_doss
 
SELECT empno, sal, ( SELECT SUM ( a.sal ) 
                                      FROM emp a ) total_sal
   FROM emp;


Above answer was rated as good by the following members:
hetal_gor
February 26, 2007 23:56:32   #1  
SHEEL2006        

RE: How to compare the total salary of all employee wi...
select sum(salary) from emp minus (select distinct(a.sal) from emp a where &n (select count(distinct(b.sal)) from emp b where a.sal< b.sal)
 
Is this answer useful? Yes | No
March 13, 2008 11:04:49   #2  
arun_doss Member Since: March 2008   Contribution: 2    

RE: How to compare the total salary of all employee with a individual employee salary for a particular department.
SELECT empno sal ( SELECT SUM ( a.sal )
FROM emp a ) total_sal
FROM emp;

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
June 05, 2009 08:41:53   #3  
sumanta.bala Member Since: June 2009   Contribution: 2    

RE: How to compare the total salary of all employee with a individual employee salary for a particular department.

SELECT ename

deptno

sal

TRUNC (AVG (sal) OVER (PARTITION BY deptno)) avg_sal

FROM scott.emp


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape