how to get second highest salary in SQL(as/4000

Answer Posted / karunakarreddy.boyapally

SELECT DISTINCT A.SAL FROM EMP A
WHERE &N=(SELECT COUNT(DISTINCT(B.SAL)) FROM EMP B
WHERE A.SAL<B.SAL)

IF SUPPOSE IF U WANT 1 HIGEST SALARY GIVE N=1
IF SUPPOSE IF U WANT 2 HIGEST SALARY GIVE N=2
IF SUPPOSE IF U WANT 3 HIGEST SALARY GIVE N=3

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum number of columns in sql table?

549


What is the most common sql injection tool?

543


What is the difference between stored procedure and view?

526


what is bdb (berkeleydb)? : Sql dba

566


Can we join 3 tables in sql?

498






What are the advantages of pl sql over sql?

546


Explain the working of primary key?

606


what is index? : Sql dba

556


What do you mean by dbms? What are its different types?

552


In a distributed database system, can we execute two queries simultaneously?

567


how to shutdown mysql server? : Sql dba

563


What is sqlerrd?

524


Is nosql relational?

546


Why do we need a foreign key?

546


What does := mean in pl sql?

553