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 |
without using count(*) and rownum how can we count total record in a table
How do we represent comments in oracle?
Is oracle the best database?
What is difference between UNIQUE constraint and PRIMARY KEY constraint ?
how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as only NN,but not other alphabets, if NN is thre means i should display , otherwise leave that blank or empty Its some urgent requirement ,thanks in advance
Display the number value in Words?
when do u go for hash partitioning?
Typically, where is the conventional directory structure chosen for Oracle binaries to reside?
if you update view? where we store the data?
What is the difference between PFILE and SPFILE in Oracle?
which language is used to develop the oracle........?
How can return max date row A b c d e 1 2 1-mar-09 5 10 1 2 10-mar-09 5 10 Only using oracle predefined function. Not user defined. Output:-- A b c d e 1 2 10-mar-09 5 10