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
Is it possible to run multiple publications and different type of publications from the same distribution database? : sql server replication
How to use group functions in the select clause in ms sql server?
Which language rdl files made of?
Do you know what is normalization of database? What are its benefits?
Explain the advantages of merge replication?
I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration
Can you explain powershell included in sql server 2008?
How to use values from other tables in update statements in ms sql server?
Write a SQL queries on Self Join and Inner Join.
what stored procedure would you use to view lock information? : Sql server administration
How to get a list of columns using the "sys.columns" view in ms sql server?
What are the 7 disadvantages to a manual system?
You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?
What is RMS migrations?
List layers of abstraction microsoft architectured to provide relational db through cloud platform ?