how to find the second highest salary from emp table?

Answers were Sorted based on User's Feedback



how to find the second highest salary from emp table?..

Answer / r.arjunarao

select a.sal from emp a where 2=(select count(distinct(b.sal)) from emp b where b.sal>=a.sal)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / rakesh a.

select Amount from PurchaseOrderDetail pod where
1=(select COUNT(amount) from PurchaseOrderDetail pod2 where pod2.Amount>pod.Amount)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / jayshree

select max(sal) from table_name where sal not in (select
max(sal) from table_name)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / tanmoy

SELECT MIN(sal) FROM (SELECT sal FROM emp ORDER BY sal DESC LIMIT 2) AS a ;

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / surya

Select max(sal) from employee where sal not in(select max
(sal) from employee)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / hemanth kumar

select salary from employees where rowid=(select rowid from
employees where rownum<=2
minus
select rowid from employees where rownum<2)
order by salary

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / manoj

select * from emp
where
sal=(select MAX(sal) from emp
where
sal<(select MAX(sal)from emp))

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / vinod dubey

select * from emp
where sal = (select max(sal) from emp where sal <>(select max(sal) from emp));

it will defiantly work

best of luck

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / nevin

select min(salary) from (select top 2 sal from table_name order by sal desc)salary

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / ram achare

for 2nd highest salary
select sal from(select distinct sal from emp order by sal desc limit 2)emp order by salary limit 1;
for 3rd highest salary
select sal from(select distinct sal from emp order by sal desc limit 3)emp order by salary limit 1;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

what is blob? : Sql dba

0 Answers  


Which table is left in left join?

0 Answers  


cursor types? explain with example programs?

1 Answers   HP,


What is data manipulation language?

0 Answers  


Where do we use pl sql?

0 Answers  






What is data control language (dcl)?

0 Answers  


How does rowid help in running a query faster?

0 Answers  


what is uncommittable transactions? : Transact sql

0 Answers  


Is there a pl/sql pragma similar to deterministic, but for the scope of one single sql select?

0 Answers  


What is pl/sql table? Why it is used?

0 Answers  


Can you inner join the same table?

0 Answers  


need to split a string into seperate values. eg. col1 col2 ---------- 100 - 'a,b,c' 200 - 'a,x,b,d,e' 300 - 'c' result: value count ------------- a - 2 b - 1 c - 2 etc.

1 Answers  


Categories