1. How to fetch all the duplicate records from the table.
2. How to fetch the second highest salary from the table.
Answer Posted / saradhi
How to fetch the second highest salary from the table.
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
where n > 1 (n is always greater than one)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain transaction server auto commit?
How do I start sql server agent automatically?
What are the differences between stored procedure and the dynamic sql?
Can we use having clause without group by?
how can you find out if the current user is a member of the specified microsoft® windows nt® group or microsoft sql server™ role? : Sql server administration
What is open database communication (odbc)?
Explain mixed authentication mode of sql server?
Can a table have 2 foreign keys?
What are functions in the sql server?
What is wrong with sql server client libarary dll, ntwdblib.dll?
What do you mean by data integrity?
Explain what are magic tables in sql server?
Tell me what is the stuff and how does it differ from the replace function?
What are the advantages of sql azure?
Why should one not prefix user stored procedures with ‘sp_’?