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 / vishakha shrivastava
for second largest salary
Select * from emp a where 2=(select count(*) from emp b
where a.sal<=b.sal)
Above mentioned query can also be used for 3 ,4 ..n
Select * from emp a where 3=(select count(*) from emp b
where a.sal<=b.sal)
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
Explain microsoft sql server functions?
What is a unique key constraint?
What is checkpoint process in the sql server?
How to drop an existing table with "drop table" statements in ms sql server?
Is sql server 2016 free?
How to enter unicode character string literals in ms sql server?
Scalability, Availability, Integration with internet, etc.)?
What happens if date-only values are provided as date and time literals?
What is primary key, unique key, and foreign key?
Explain different types of Normalization.
What is use of except clause?
How you can find out if an index is useful to the optimizer?
What is an example of a foreign key?
What is difference between stored procedure and user defined function?
What is compression - row-level and page-level compression?