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 is a join in sql?

583


What are two difference between sql azure and azure tables?

137


How can windows applications connect to sql servers via odbc?

582


Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?

613


What are partitioned views and distributed partitioned views?

600






How can I add Reporting Services reports to my application?

91


Tell about MOM Tool(Microsoft Operator Manager)?

1411


What are sparse columns?

584


how many type of indexing in database?

575


What are the functions in sql server?

541


What you can do to delete a table without the delete trigger firing?

519


Why do we use sql limitations? Which constraints can we use while making a database in sql?

559


Describe how to use the linked server?

596


What’s the distinction between dropping a info and taking a info offline?

592


What are synonyms?

523