write the query for find the top 2 highest salary in sql
server

Answer Posted / tanay chaudhary

select * from(select emp.*,Dense_Rank() over(order by salary desc) as ranking from emp)as e where e.ranking in(1,2)

//emp=table name
//salary=column name

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a non equi join?

530


Explain a checkpoint?

528


How to call stored procedure using http soap?

509


What is report snapshot in ssrs?

160


What types of replication are supported in sql server?

554






Do you know what are the restrictions applicable while creating views? : SQL Server Architecture

545


How can you know if the row fetched from cursor is still valid in underlying table?

510


How to create a simple user defined function in ms sql server?

535


Can we call future method from queueable?

586


How to rebuild all indexes on a single table?

575


Explain what is scheduled job and how to create it?

539


Which tcp/ip port does sql server run on? How can it be changed?

564


List the advantages of using stored procedures?

553


What are sql azure firewall rules?

85


What is oltp (online transaction processing)?

577