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
What is the difference between commit and rollback?
What is sql server management studio? : sql server management studio
How to rebuild the master database?
Explain what are partitioned views and distributed partitioned views?
How do I open a .db file?
What is merge replication?
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?
Detail about the hardware which is supported by SQL server?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
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
What are blobs, tables, and Queues? Is SQL is the standard way to query blobs, tables, and queues?
What are the properties of primary key?
What are the different methods available under sqlcommand class to access the data?
What do we need queues in sql service broker?
What is SQL Azure Firewall?