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
What is the default value of an integer data type in sql server 2005?
What is the difference between truncate and delete commands?
How can a user-defined datatype be created?
What is the use of stored procedure?
What purpose does the model database server?
what's the difference between delete table and truncate table commands? : Sql server database administration
What are the tool windows in sql server management studio? : sql server management studio
Explain the xml support sql server extends?
What is @@error in sql?
What is the Difference Between Primary and Foreign Key?
Explain system scalar functions?
What are examples of triggers?
What happens if null values are involved in comparison operations?
How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication
What happens if we shrink log file in sql server?