Select the Nth lowest value from a table?
Answers were Sorted based on User's Feedback
Answer / mahesh
select *from(select ename,sal,row_number()over(order by sal desc) rk from emp) where rk=2;
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / nishi
select level, min('col_name') from my_table where level = '&n' connect by prior
('col_name') <'col_name') group by level;
Example:
Given a table called emp with the following columns:
-- id number
-- name varchar2(20)
-- sal number
--
-- For the second lowest salary:
-- select level, min(sal) from emp
-- where level=2
-- connect by prior sal < sal
-- group by lev
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / venkat
select * from emp minus select * from emp where rownum <= (select count(*) - &n from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / basanti
select * from(select rownum,ename from employee order by rownum desc) where rownum<=5;
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain about integrity constraint?
How to use subqueries with the in operator using oracle?
What is procedure overloading in oracle?
How to shutdown your 10g xe server from command line?
What is a proxy object?
What is connection pool in oracle?
Difference between hot backup vs. Cold backup?
Define the SGA and: How you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA?
What is a deadlock in SQL? How can you prevent it?
What is a Garbage Collection? and what is full recursive Garbage collection?
Explain the use of full option in exp command.
What is blob data type in oracle?