Find out the 3rd highest salary?

Answers were Sorted based on User's Feedback



Find out the 3rd highest salary?..

Answer / a.jyothsna

select a.sal
from emp a
where 3=(select distinct(count(b.sal))
from emp b
where a.sal<=b.sal)

Is This Answer Correct ?    100 Yes 45 No

Find out the 3rd highest salary?..

Answer / kaushal kassi

select distinct a.sal
from employee a
where 3=(select count(distinct b.sal)
from employee b
where a.sal<=b.sal)

Is This Answer Correct ?    24 Yes 12 No

Find out the 3rd highest salary?..

Answer / srikanth

select q.sal
from emp q
where 3=(select distinct(count(b.sal))
from emp b
where q.sal<=b.sal)

Is This Answer Correct ?    17 Yes 10 No

Find out the 3rd highest salary?..

Answer / karna

Hi Friends,

to get the nth highest value of a column in a table,please
use the below simple query

select min(column) from table where column in(select top n
column from table)

any queries,mail me at karun84@gmail.com

Is This Answer Correct ?    9 Yes 2 No

Find out the 3rd highest salary?..

Answer / karna

Hi Friends,

sorry,last answer was wrong.
I have changed the query,check now

to get the nth highest value of a column in a table,please
use the below simple query

select min(column) from table where column in(select top n
column from table order by desc)

any queries,mail me at karun84@gmail.com

Is This Answer Correct ?    10 Yes 3 No

Find out the 3rd highest salary?..

Answer / surendra kumar dattatrey

Select * from Emp where Salary =
(Select max(Salary) from Emp where Salary <
(Select max(Salary) from Emp where Salary <
(Select max(Salary) from Emp where Salary <.....N))))

Is This Answer Correct ?    8 Yes 2 No

Find out the 3rd highest salary?..

Answer / abhay

select distinct(sal) from emp a where 3=(select
count(distinct(sal) from emp b where a.sal<=b.sal);


somebody tell me he logic....!

Is This Answer Correct ?    6 Yes 1 No

Find out the 3rd highest salary?..

Answer / sachin

select distinct(sal) from employee order by sal desc limit 2,1;

Is This Answer Correct ?    5 Yes 0 No

Find out the 3rd highest salary?..

Answer / anjali

select min(column_name) from table where column in(select
top n
column_name from table order by column_name desc)

Is This Answer Correct ?    4 Yes 1 No

Find out the 3rd highest salary?..

Answer / amit singh

Empsal table data
700
500
100
900
400
200
600
750


query to find second highest salary from table Empsal

mysql>select distinct(max(e.salary)) from Empsal e
>where e.salary in(
>select e1.salary from Empsal e1 where e1.salary<
(select max(salary) from Empsal));

Output=750



query to find third highest salary from table Empsal


mysql>select distinct(max(e.salary)) from Empsal e
>where e.salary in(
>select e1.salary from Empsal e1 where e1.salary<
>(select max(e1.salary) from Empsal e1
>where e1.salary IN(
>select e2.salary from Empsal e2 where
>e2.salary<(select max(salary) from Empsal))));
Output=700

RUN THE QUERY THEN ARG
amitsing2008@gmail.com(amit is back)

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is insert command in sql?

0 Answers  


List out the acid properties and explain?

0 Answers  


What is sql architecture?

0 Answers  


Can dml statements be used in pl/sql?

0 Answers  


What is partition in sql query?

0 Answers  






What is data control language (dcl)?

0 Answers  


How to call shell script from pl sql procedure?

0 Answers  


What is a database event trigger?

0 Answers  


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

0 Answers  


What is the difference between function, procedure and package in pl/sql?

0 Answers  


What are different clauses used in sql?

0 Answers  


I have a tablle like this. cust acc --------------- a 1 b 2|3 c 4|5|6 I Want below o/p: cust acc ----------- a 1 b 2 b 3 c 4 c 5 c 6 Please any one can you have any ideas share me. I have urgent requirement.

4 Answers   Cap Gemini, MTS,


Categories