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 |
In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?
How to remove a row in a database table?
What are the types of synonyms?
What are the different types of database objects?
Which Database is the best for the Security issue ? 1. DB2 2.SQL Server 3.MySQL 4.ORACLE
What is dictionary cache ?
How to define an explicit cursor in oracle?
What is the data type of dual table?
What are group functions in oracle?
How are extents allocated to a segment?
How would you design a database for an e-commerce website?
Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).