how to retrieve the top 3 salaries of the table using rownum

Answers were Sorted based on User's Feedback



how to retrieve the top 3 salaries of the table using rownum..

Answer / seema

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

Is This Answer Correct ?    1 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / kavitha

select employee_id,last_name,salary
from employees
where rownum <=3
order by salary desc

Is This Answer Correct ?    1 Yes 1 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / kamal

Hello Sir

I wana to see this that how to retrieve 3 top salary by
subqurey can you gave me this answer.

Thanks

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / saisravanthi

select salary from
(select salary,rownum from salary_tab
order by salary_tab desc)
where rownum < 4;

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / manoj tcs

select * from (select * from emp order by sal desc)
where rownum < 4;

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / raveendran

SELECT EMP_BASICS,ROWNUM FROM EMPLOYEE_MASTER WHERE
EMP_BASICS IS NOT NULL AND ROWNUM<=3 ORDER BY EMP_BASICS
DESC

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / k.thrilok kumar

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

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / rajnish chauhan

you can put any number on Rnk.

---Top 3 salary
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk<4

-----Top 3 Salary only
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk=3

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / debbie

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

Is This Answer Correct ?    0 Yes 0 No

how to retrieve the top 3 salaries of the table using rownum..

Answer / chiru

select sal from (select distinct sal from emp order
by sal desc)
where rownum<4 ;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

how many groups of data types? : Sql dba

0 Answers  


What is trigger in sql? Explain

0 Answers  


How do you break a loop in pl sql?

0 Answers  


write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and case statements.

3 Answers   Zensar,


How many sql core licenses do I need?

0 Answers  






Difference between IN and EXISTS

4 Answers   Nous, Polaris,


What are its different types of dbms?

0 Answers  


What are all the different types of indexes?

0 Answers  


declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal'); else if l1<>l2 then message('not equal'); else message('else'); end if; end if; end; What will be the output ?

7 Answers   Oracle,


how to enter numeric values as hex numbers? : Sql dba

0 Answers  


What is sql query limit?

0 Answers  


My select statement is not working as expected, So, to overcome from such issues what are the steps needed to be taken care?

2 Answers   CG,


Categories