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 is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?
Benefits of Stored Procedures?
What is the filtered index?
What is the security principal at the database level that represents your session?
How to provide values to user defined function parameters?
What are drillthrough reports?
What is 1nf normalization form?
what is a default tcp/ip socket assigned for sql server? : Sql server database administration
What is a data source file?
When is update_statistics command used?
What are subqueries in sql server? Explain its properties.
Can you explain about buffer cash and log cache in sql server?
Explain in details security in SQL azure?
What is a group function explain with an example?
How to create database with physical files specified in ms sql server?