GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 138 of 171    Print  
Write a query to display employee records having same salary?

  
Total Answers and Comments: 5 Last Update: October 15, 2008     Asked by: kowmudiswarna 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: vanigreat
 


select a.empno,a.ename,a.sal from scott.emp a where a.sal in

(select sal from scott.emp group by sal having count(*)>1)



Above answer was rated as good by the following members:
spohilko, sureshkumar.mtech, harit79
September 21, 2007 06:53:33   #1  
Ashutosh Srivastava        

RE: Write a query to display employee records having s...
select * from emp where sal in(
select sal from emp where rowid not in(
select max(rowid) from emp group by sal))


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 08, 2008 04:49:45   #2  
vanigreat Member Since: January 2008   Contribution: 4    

RE: Write a query to display employee records having same salary?


select a.empno a.ename a.sal from scott.emp a where a.sal in

(select sal from scott.emp group by sal having count(*)>1)


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 22, 2008 07:53:54   #3  
Shilpa.Paschapur Member Since: January 2008   Contribution: 1    

RE: Write a query to display employee records having same salary?
hi..
select name salary from emp e1 emp e2 where e1.esalary e2.esalary

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 1Overall Rating: -N/A-    
January 29, 2008 05:08:13   #4  
patilpravin_1981 Member Since: December 2007   Contribution: 29    

RE: Write a query to display employee records having same salary?
select e1.ename e2.salary from emp e1.emp e2 where
e1.emp_id e2.emp_id

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
October 15, 2008 07:50:14   #5  
sureshkumar.mtech Member Since: May 2008   Contribution: 37    

RE: Write a query to display employee records having same salary?

SQL> select distinct e.name e.salary from employe e employe a
2 where e.salary a.salary and e.name ! a.name;

NAME SALARY
---------- ----------
MANI 10000
SELVAM 10000
SURAJ 10000
KAMAL 20000
RAMESH 20000
SARA 20000

6 rows selected.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
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