To find second largest salary in Employee table
Answer Posted / v rajkumar
Select min(salary)FROM emp WHERE salary IN (SELECT distinct
TOP 2 salary FROM emp ORDER BY salary desc)
OR
Select top 1 salary from (select distinct top 2 salary from
emp order by salary desc) emp order by salary
OR
select max(salary) from emp where salary <(select max
(salary) from emp)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can a cursor be updated? If yes, how you can protect which columns are updated?
If a table does not have a unique index, can a cursor be opened on it?
What is system stored procedures?
what is database replicaion? : Sql server database administration
Explain log shipping?
Which data types generate inaccurate results if used with an = or <> comparison in a where clause of a sql statement?
what is package and it uses and how can u call a package
What happens if you are trying to access a schema not owned by you?
Can you force a query to use a specific index?
How to check status of stored procedure in sql server?
Explain the etl (extraction, transformation, and loading)?
How do I view a script in sql server?
What command is used to create a database in the sql server and how?
How many cores do I need for sql server 2016?
What do you understand by sql server agent?