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
How many types of cursor type are there?
How to get a list all databases on the sql server?
What is application role in sql server database security? : sql server security
Why do we use sql limitations? Which constraints can we use while making a database in sql?
Differentiate between mongodb vs. Sql server?
What are the different sql server versions?
Is it possible to call a stored procedure within a stored procedure?
What is raid? : SQL Server Architecture
How to create view in stored procedure sql server?
What is purpose of normalization?
What are the types of lock supported by ?
Write an sql query to find first weekday of the month?
What is star, snowflake and star flake schema? : sql server analysis services, ssas
Give an example of SQL injection attack ?
What is de-normalization in sql database administration? Give examples?