from the table display the 2nd highest salary?
and also the least 2nd salay?

Answer Posted / sridhar sahoo

select distinct top 1 salary from payroll..emp where salary
in(select distinct top N salary from payroll..emp order by
salary desc)

if u want top 2 put 2 at the pacece of N
if u want top 5 put 5 at the pacece of N
if u want ..............................

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain microsoft sql server functions?

540


Explain about integration services of Microsoft SQL server?

583


How do you test your database? : sql server database administration

521


How many types of built in functions are there in sql server 2012?

488


How to enter binary string literals in ms sql server?

580






What is report server project?

106


Explain having clause and where clause?

576


How to create stored procedures with parameters in ms sql server?

526


How can a database be repaired?

566


What are cursors in ms sql server?

593


Explain how to send email from sql database?

560


Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?

611


Explain how many types of relationship?

571


How to invoke a trigger on demand?

538


How to locate and take substrings with charindex() and substring() functions?

508