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 |
Display Odd/ Even number of records?
1) Does oracle have any table which contain all the exceptions and it's code internally?
What is a cursor variable?
How to check your oracle database 10g xe installation?
Hi can anyone tell me where are the dumps found of OCA certification.. Also the materials to be studied for the preparation.
How to delete a column in an existing table?
How to calculate date and time differences in oracle?
How to create a new user account in oracle?
How to turn on or off recycle bin for the instance?
In Oracle Clinical 4.5.0, can the VIEW_TEMPLATE_ID column in DATA_EXTRACT_VIEWS table contain NULL value?
How to update values in a table in oracle?
what are bitmap indexes? How does they work?