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
Describe and explain about SQL native client?
What is GUID in sql server?
What factors you will consider calculating the storage requirement for that view?
How do I debug a stored procedure in sql server?
We need to perform what steps in the following order to work with a cursor?
Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?
What do you mean by an execution plan?
What is bcp? When does it use?
What are the options which must be set to allow the usage of optimistic models?
Do I need a report server to run reports in my application?
What is 1nf 2nf and 3nf?
What are the differences between decimal and float in ms sql server?
What is 3nf normalization form?
What is the Control Flow in SSIS
What are four major operators that can be used to combine conditions on a where clause?