how to find nth highest salary

Answer Posted / bharath

select distinct(sal) from emp a where 3 = (select
count(distinct(sal)) from emp b where a.sal<= b.sal)

replace 3 by 2 for second highest...

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is query optimizer in sql server?

543


What are the two modes of authentication in sql server?

518


What is the command used to check locks in microsoft sql server?

538


Define synonym?

726


What is buffer cash and log cache in sql server?

593






Explain various data region available in ssrs with their use?

490


How to create a user to access a database in ms sql server using "create user" statements?

520


What do you understand by sql server agent?

531


How to create new tables with "create table" statements in ms sql server?

563


Why functions are used in sql server?

502


What happens when converting big values to integers?

568


What are the different types of stored procedures?

550


What is inline variable assignment?

599


How do I find the default sql server instance?

516


How to create user defined functions with parameters?

636