find the second highest salary of the emp table

Answer Posted / ramesh mopuri

okay above queries are fine
but in a table there are 99 salaries, so i want to pick the
50th highest salary is it possible to wright the query same
above for the get 50th high salary. absolutely not. see my
query for the get Nth salary in a table.

Select ename,sal,deptno from emp a
where &n=
(select count(distinct(sal))from emp b
where a.sal<=b.sal)
order by deptno;

after enter this query the system ask N value and give 50
the result will be shown 50th highest salary. Please reply
me whether its working or not.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is enter substitution variable in oracle?

576


How do we represent comments in oracle?

631


How to retrieve values from data fields in record variables?

572


What is set verify off in oracle?

583


Can we store images in oracle database?

555






What do you mean by redo log file mirroring?

561


What is meant by joins?

625


1) What is ONE_SIZE_FITS_ALL approach? 2) Explain the Common & Variable Header of DATA FILE? 3) What are the Drawbacks to using OMF DB? and the Advantages? 4) List out the Advantages of Undo T.spaces over the Undo SEGMENT? 5) Difference between the Temporary tablespace with TEMPFILE and the Tablespace with TEMPORARY Keyword? 6) What are the situation extents are freeing for reuse.

1618


What is define in oracle?

571


What privilege is needed for a user to query tables in another schema?

513


What is meant by an index?

629


How to return top 5 rows in oracle?

550


What is recovery manager in Oracle?

593


How to connect to a remote server?

564


What is a trigger and what are its types?

615