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 / amar banerjee

sol1> select MAX(salary) from emp where salary< (select MAX(salary) from emp);

sol2> select salary from emp sort by salary desc limit 1,1;

for finding nth position

select salary from emp sort by salary desc limit n-1,1;

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does top operator do?

748


How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?

758


What are views used for?

778


How can sql injection be stopped? : sql server security

711


Indexes are updated automatically is the full-text index also updated automatically?

793






Suppose we have a table "MyTable" containing 10 rows, what query should be executed to update the odd rows "Salary" as 9000?

751


What are joins in sql and what are the different types of joins?

712


What is the concept of optimization?

776


What is sql stored procedure?

785


How do I view a trc file?

682


What is dynamic cursor in SQL SERVER?

740


How column data types are determined in a view?

683


what is a deadlock? : Sql server database administration

679


What is merge replication?

861


What keyword you will use to get schema appended to the result set of a ‘for xml’ query?

781