how to get top two salaries from employee tables

Answers were Sorted based on User's Feedback



how to get top two salaries from employee tables..

Answer / rituparna

select salary from (select salary from emp order by salary
desc)
where rownum < 3;

Is This Answer Correct ?    10 Yes 3 No

how to get top two salaries from employee tables..

Answer / maruti

select max(sal)
from emp
where sal < (select max(sal) from emp);

with this query u ll get second largest sal of that table
if u want to know max (sal) then it ll be...
select Max(sal)
from emp;

Is This Answer Correct ?    4 Yes 0 No

how to get top two salaries from employee tables..

Answer / varu

This will be right answer for the query

Select * from empsal e where 2<=(select count(*) from empsal f
where e.sal>f.sal) order by sal desc

Is This Answer Correct ?    4 Yes 0 No

how to get top two salaries from employee tables..

Answer / charan

hi this is charan,
select e1 *from employees e1
where 2>
( select column(distincte2.sal)
where e2.sal>e1.sal )

Is This Answer Correct ?    4 Yes 1 No

how to get top two salaries from employee tables..

Answer / shiva - e-softsys

SELECT MIN (SALARY) FROM EMP WHERE

SALARY IN (SELECT DISTINCT TOP 2 SALARY FROM EMP ORDER BY
SALARY DESC)

Is This Answer Correct ?    4 Yes 1 No

how to get top two salaries from employee tables..

Answer / usha

select top 2 salary from employee order by desc

Is This Answer Correct ?    3 Yes 1 No

how to get top two salaries from employee tables..

Answer / rajendra prasad reddy penumall

this is a SQL query

SELECT DISTINCT salary FROM employee WHERE(max(salary))

Is This Answer Correct ?    3 Yes 3 No

how to get top two salaries from employee tables..

Answer / satya

Hi,

Select * from emp e where 2>=(select count(*) from emp e
where sal>e.sal) order by desc sal.

Let me know if this query is wrong.

Is This Answer Correct ?    2 Yes 2 No

how to get top two salaries from employee tables..

Answer / sivaprasad

SELECT MIN(SALARY) FROM EMP WHERE SALIN(DISTINCT TOP2
SALARY FROM EMP ORDER BY SALARY DESC.

OR
SELECT TOP 2 SALARY FROM EMP ORDER BY SALARY DESC.

Is This Answer Correct ?    2 Yes 2 No

how to get top two salaries from employee tables..

Answer / varu

writing this way is also correct

select sal
from empsal
where id > 2
order by sal desc

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Manual Testing Interview Questions

if u find a bug and reported to devoloper, but he is not agree with ur openion what u will do,how u convince to them

7 Answers   SunGard,


Pls give proper Seq. to following testing Types Regression,Retesting,Funtional,Sanity and Performance Testing.

4 Answers   Syntel,


what is stlc and what is bug life cycle? are the both same or different?

3 Answers  


who will assign the seviourity & priority for a BUG in a project ? tester or any other.......... ????

6 Answers  


integration test cases for mouse and keyboard

0 Answers   Datamatics,






how to write testcase for toaster?

1 Answers  


waht is client server application testing?

2 Answers  


say me any problem u faced in the project after delivering to client?

2 Answers   Mantra Group,


what are the system testing techiniques?

2 Answers  


What is the procedure to write test cases and what are the conditions to write test cases? please say...

2 Answers  


give me some brief idea about audits

2 Answers   Synechron,


what is smoke testing? what is sanity testing?

5 Answers  


Categories