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 / 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

What is an oracle function?

0 Answers  


How to create a single index for multiple columns?

0 Answers  


What are the factors causing the reparsing of SQL statements in SGA?

2 Answers  


Why do we use bulk collect in oracle?

0 Answers  


5. Display full details from the ORDER_LINE table where the item number is (first condition) between 1 and 200 (no > or < operators) OR the item number is greater than 1000 AND (second condition) the item cost is not in the list 1000, 2000, 3000 OR the order number is not equal to 1000.

3 Answers   Wipro,






which is best insttute for teradata,sybase,mysql,oracle in hyderabad

1 Answers  


How to define a sub function?

0 Answers  


HI Friends Myself Manoj,i am from bengaluru.i have 1 yr of exp in PLSQL but not upto the mark..now attending interviews but m not able to clear even 1 round..i have attended 3 interviews till today.purpose of writing this query is,i want to know the intreview topics that interviewer going to ask frequently,mainly SCENARIO based questions.IF anybody have any PLSQL projects please give it to me,it will helps me alot.Thanks for your patience.

0 Answers  


select to_char('10','10') from dual This gives me an error oRA-1481 INVALID NUMBER FORMAT MODEL why? pls help

6 Answers  


Where do you use decode and case statements?

0 Answers  


what are the advantages of running a database in archive log mode?

0 Answers  


Using the relations and the rules set out in the notes under each relation, write statements to create the two sequence generators specified in the notes.

0 Answers   Wipro,


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • 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)