find the third highest salary?

Answers were Sorted based on User's Feedback



find the third highest salary?..

Answer / anu

select *
FROM (select emp1.* ,rownum rnum
     from ( select *  from emp order by sal_amount desc ) emp1
     where rownum<=3) 
where rnum >=3   

Is This Answer Correct ?    1 Yes 0 No

find the third highest salary?..

Answer / farrukh shaikh

select vu.sal from
(select DENSE_RANK() over(order by sal desc) as sr,
sal from emp) vu
where vu.sr=3

Is This Answer Correct ?    3 Yes 3 No

find the third highest salary?..

Answer / meher

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

--Pass the value for N as 2 to get 3rd highest salary.
--pass 0 for highest sal,1 for 2nd highest,2 for 3rd
highest and so on....

Is This Answer Correct ?    6 Yes 6 No

find the third highest salary?..

Answer / pradeep

select * from emp where sal in(select min(sal) from (select
sal from emp order by sal
desc) where rownum <= 3);

Is This Answer Correct ?    3 Yes 3 No

find the third highest salary?..

Answer / gautam

select * from (
SELECT ROWNUM as RANK, ename, sal
FROM (SELECT ename,sal FROM emp ORDER BY sal DESC)
WHERE ROWNUM <= 3)
where rank=3

Is This Answer Correct ?    1 Yes 1 No

find the third highest salary?..

Answer / deepak kumar

SELECT sal FROM empORDER BY sal DESC LIMIT 2 , 1

Is This Answer Correct ?    0 Yes 0 No

find the third highest salary?..

Answer / yankee

select * from (select * from <table_name> order by salary
desc)where rownum<4

---this way u can get the record of the top 3 salaries and
easily filter out the 3rd positioned salary from there.

Is This Answer Correct ?    4 Yes 5 No

find the third highest salary?..

Answer / mousumi dalai

select min(sal) from emp where sal in
( select sal from
(select sal from emp order by sal desc)
where rownum<=3)

Is This Answer Correct ?    0 Yes 1 No

find the third highest salary?..

Answer / anil pednekar

select * from (select sal from table1 group by sal ) where
row num=3

Is This Answer Correct ?    1 Yes 2 No

find the third highest salary?..

Answer / satish prajapati

select min(sal) from (select
sal from emp order by sal
desc) where rownum <= 3

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

in sql table follw columns r their vehicle_no|servicetype|date|location| 1234 |1FS |1-JAN|PUNE| 4561 |2FS |5-JAN|PUNE| 1234 |PS |7-JAN|PUNE| 1234 |PS |15-JAN|MUMB| i want o/p below vehicleno|1fs|1fsdate|1fslocation|1ps|1PSDATE|1PSLOC|2PS|2PS DATE|2PSLOCA e.g 1234|1FS|1JAN|PUNE|1PS|7JAN|PUNE|2PS|15JAN|MUMBAI PLS help me out to execute using sql query

1 Answers  


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

0 Answers  


What is left join example?

0 Answers  


What are the sql aggregate functions?

0 Answers  


What is compound trigger?

0 Answers  






In pl/sql, what is bulk binding, and when/how would it help performance?

0 Answers  


What is pragma in sql?

0 Answers  


hi..........i m Accenture employee...Accenture is an IT company having itz branches in India at Mumbai, Pune,Delhi, Hyderabad, Chennai and Bangalore....Presently there are openings here for SAP, Testing, Oracle,Java,.NET,MAinframe and Peoplesoft...... I am a software engineer working with Accenture,Mumbai....u can mail me in your resume..i`ll forward it to our HR team...my mail id: pankit.lodaya@accenture.com

8 Answers   Wipro,


wa procedure to return the month and the no'f developers joined in each month.

4 Answers   Fidelity,


How to use distinct and count in sql query? Explain

0 Answers  


what is the sql query to display current date? : Sql dba

1 Answers  


select 10 from dual; y its showing all the rows with 10?

1 Answers  


Categories