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
What are the differences between local and global temporary tables?
How to create an inline table-valued function?
How would you go about developing a ssrs report?
What the different components in replication and what is their use?
Explain “@@rowcount” and “@@error” in sql server?
What is difference between delete & truncate commands?
What are different types of collation sensitivity?
Explain the Ways to improve the performance of a sql azure database?
What is scheduled job and how to create it?
How to create an index on an existing table in ms sql server?
How to automatically create a log when an exception is being received into SQL Server?
What are orphan records?
Give main differences between "Truncate" and "Delete".
Explain hostprotectionattribute in sql server 2005?
What is data compression? : sql server database administration