How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database

plz mail the answer @ mak2786@gmail.com

Answer Posted / g

TO FIND THE 3rd,

select max(sal) from emptable where salary not in(select
distinct top 2 sal from emptable)

TO FIND THE 4th,

select max(sal) from emptable where salary not in(select
distinct top 3 sal from emptable)

TO FIND THE 5th,

select max(sal) from emptable where salary not in(select
distinct top 4 sal from emptable)

keep change top value...

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the properties of primary key?

517


What is database white box testing?

678


What is sql injection? How to protect against sql injection attack?

557


State the difference between union and union all?

523


What are the built in functions in sql server?

491






What are the advantages of using stored procedures in sql server?

512


what is a join and explain different types of joins? : Sql server database administration

541


What is microsoft sql server?

542


What is inner join in sql server joins?

545


Why and when do stored procedure recompile?

546


How to install sql server 2005 express edition?

594


How many triggers you can have on a table?

533


Describe the left outer join & right outer join. : sql server database administration

584


How to set database to be single_user in ms sql server?

569


What is raiseerror? What is raiseerror?

646