I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000

Answer Posted / deepa

drop table #temp
select top 2 identity(int,1,1) as SlNo, *
into #temp from employee order by salary desc
select * from #temp where SlNo = 2

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between commit and rollback?

673


What is sql server management studio? : sql server management studio

740


How to rebuild the master database?

750


Explain what are partitioned views and distributed partitioned views?

712


How do I open a .db file?

732






What is merge replication?

863


How many files can a database contain in sql server?how many types of data files exists in sql server? How many of those files can exist for a single database?

840


Detail about the hardware which is supported by SQL server?

758


Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?

751


my name is sejal I have cleared the sbi clerk exam. I am BCA graduate My favorite subject RDBMS Relational database management system. so please send me rRDBMS related interview questions

1708


What are blobs, tables, and Queues? Is SQL is the standard way to query blobs, tables, and queues?

131


What are the properties of primary key?

715


What are the different methods available under sqlcommand class to access the data?

855


What do we need queues in sql service broker?

694


What is SQL Azure Firewall?

128