How to find 1st, 2nd, 3rd highest using select select
statement not using rownum

Answers were Sorted based on User's Feedback



How to find 1st, 2nd, 3rd highest using select select statement not using rownum..

Answer / madhavi

SELECT sal
FROM (SELECT sal, RANK() OVER(ORDER BY sal DESC) AS rnk
FROM emp)
WHERE rnk IN (1,2,3);

Is This Answer Correct ?    14 Yes 3 No

How to find 1st, 2nd, 3rd highest using select select statement not using rownum..

Answer / ajit

select distinct *
from (select e.*,dense_rank()over(order by sal desc) rn from emp e)
where rn in (1,2,3);

Is This Answer Correct ?    0 Yes 0 No

How to find 1st, 2nd, 3rd highest using select select statement not using rownum..

Answer / annada

SELECT e.lastname,e.salary FROM employees e
WHERE 1=(SELECT count(*) FROM employess s
WHERE s.salary>e.salary

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Oracle General Interview Questions

How oracle handles dead locks?

0 Answers  


How will you write a query to get a 5th rank student from a table student_report?

0 Answers  


Explain the use of control file?

0 Answers  


What are Clusters ?

5 Answers   Amdocs, Infosys,


How to export your connection information to a file?

0 Answers  


What is difference between SUBSTR and INSTR?

1 Answers  


How to convert csv to table in oracle?

0 Answers  


How to increment dates by 1 in oracle?

0 Answers  


What do you mean by merge in oracle and how can you merge two tables?

0 Answers  


Describe an oracle table?

0 Answers  


sql command 2 know current database

4 Answers  


What is recycle bin in Oracle?

0 Answers   MCN Solutions,


Categories
  • Oracle General Interview Questions Oracle General (1808)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)