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 raw datatype?

671


What are the different pseudo commands? Explain in general?

657


What is index-organized table in Oracle?

657


Explain how are indexes update?

700


What privilege is needed for a user to create tables in oracle?

632






How do I spool in oracle?

633


What is meant by a deadlock situation?

664


State the difference along with examples between Oracle 9i, Oracle 10g and Oracle 11i.

699


What is a parameter file in oracle?

645


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

1496


Using the relations and the rules set out in the notes under each relation, write table create statements for the relations EMPLOYEE, FIRE and DESPATCH. You should aim to provide each constraint with a formal name, for example table_column_pk.

1438


Explain an index?

752


What is the Tune Query

1924


What is an oracle table?

639


Why do we use coalesce function in oracle?

727