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 length of a table name, database name, and fieldname in mysql? : Sql dba

621


What are inbuilt functions in sql?

602


What are the possible values for the boolean data field?

527


Explain the difference between cursor declared in procedures and cursors declared in the package specification?

579


What is the maximum rows in csv?

487






How do I turn a list into a table?

512


how to create a new table in mysql? : Sql dba

550


What is pl sql package?

597


Do we need to create index on primary key?

468


how do you know the version of your mysql server? : Sql dba

506


How we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?

596


How do you drop a trigger?

544


What are basic techniques of indexing?

849


What is a heap in sql?

529


What is trigger types in sql?

537