how to find the second salary?

Answer Posted / vamsi krishna

For 2nd maximum salary
select Max(sal) from EMP a where 2=(select COUNT(distinct(sal)) from EMP b where a.SAL<=b.SAL);

Is This Answer Correct ?    14 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference function and stored procedure?

560


What is the need for indexing?

490


What is ms sql server service broker?

509


Why use triggers?

565


How to generate random numbers with the rand() function in ms sql server?

560






What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

553


How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?

588


What is the maximum size of a row in sql server?

517


How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?

1571


how many type of indexing in database?

571


How to drop an existing table with "drop table" statements in ms sql server?

548


Explain indexed views?

553


What are the different types of locks in the database?

486


Explain the truncate command? : SQL Server Architecture

558


Which are ddl commands?

538