GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Database  >  Sybase
Go To First  |  Previous Question  |  Next Question 
 Sybase  |  Question 4 of 56    Print  
How to find the 2 minimum salaries in a table?

  
Total Answers and Comments: 20 Last Update: June 16, 2008     Asked by: kosmos 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
August 18, 2006 16:23:32   #1  
Manoj Thomas        

RE: How to find the 2 minimum salaries in a table

set rowcount 2

select salary from employee order by salary


 
Is this answer useful? Yes | No
September 01, 2006 03:53:05   #2  
Gorilla Killa        

RE: How to find the 2 minimum salaries in a table
The posted answer in wrong.Correct answer would beset rowcount 2select distinct salary from employee order by salaryThis will take care of any repeats.
 
Is this answer useful? Yes | No
September 13, 2006 11:00:09   #3  
visweswar        

RE: How to find the 2 minimum salaries in a table

May be you only mistaken.

If the Query is for 2 minimum salary rows. Then even the Salary amount can be equal. In that case the 1st answer is correct.


 
Is this answer useful? Yes | No
September 26, 2006 23:17:31   #4  
sa10        

RE: How to find the 2 minimum salaries in a table
You guys forgot to add "ORDER BY salary ASC"
 
Is this answer useful? Yes | No
September 29, 2006 11:18:29   #5  
vimal        

RE: How to find the 2 minimum salaries in a table

Hi,

select min(salary) from employee where salary >(select min(salary) from employee)

 Thanks,

  Vimal.


 
Is this answer useful? Yes | No
October 11, 2006 03:16:15   #6  
gurveen singh rekhi        

RE: How to find the 2 minimum salaries in a table

Vimal told us the second part .. ( the second minimum salary ) . For the first min its simple :

select salary, min(salary) from employee where salary >(select min(salary) from employee) group by salary.


 
Is this answer useful? Yes | No
October 28, 2006 06:29:46   #7  
Jagadish        

RE: How to find the 2 minimum salaries in a table

The following article can clarify your doubt:

http://searchoracle.techtarget.com/ateQuestionNResponse/0,289625,sid41_cid504195_tax301455,00.html


 
Is this answer useful? Yes | No
October 30, 2006 09:22:26   #8  
Hrushikesh Thite        

RE: How to find the 2 minimum salaries in a table

select TOP 2 * from emp_salary

order by salary desc....

this is quite simple.....


 
Is this answer useful? Yes | No
February 19, 2007 00:40:06   #9  
ashish gag        

RE: How to find the 2 minimum salaries in a table?
select top 2 salary from sal order by salary asc;
 
Is this answer useful? Yes | No
March 13, 2007 07:50:50   #10  
Shailendra        

RE: How to find the 2 minimum salaries in a table?

hi,
Since you are using the order by clause, please be informed that asc should not be mentioned, as Order by cluase by default sorts the required column  in the descending order....


 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape