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

oracle is compiler or interpretter,can any one tell me the answer?

9 Answers   Satyam,


What is the difference between microsoft access and sql server?

0 Answers  


What is the use of function in sql?

0 Answers  


What is the difference between UNIQUE CONSTRAINT and PRIMARY KEY? 1. There is no difference. 2. A PRIMARY KEY cannot be declared on multiple columns. 3. A UNIQUE CONSTRAINT cannot be declared on multiple columns. 4. A table can have multiple PRIMARY KEYS but only one UNIQUE CONSTRAINT. 5. A table can have multiple UNIQUE CONSTRAINTs but only one PRIMARY KEY.

7 Answers   Satyam,


what is query cache in mysql? : Sql dba

0 Answers  






Can you alter start with clause?

1 Answers   TCS,


what is the difference between delete and truncate commands? : Sql dba

0 Answers  


What is the basic structure of PL/SQL ?

6 Answers  


what is an extent ? : Sql dba

0 Answers  


What are stored procedures in mysql?

0 Answers  


What is the difference between join and natural join?

0 Answers  


Explain the savepoint statement.

0 Answers  


Categories