how to retrieve 1st and last row of table without using
group functions??
Answers were Sorted based on User's Feedback
Answer / prabhudatta
SELECT * FROM (SELECT * FROM EMP ORDER BY EMP_NO) WHERE
ROWNUM=1
UNION
SELECT * FROM (SELECT * FROM EMP ORDER BY EMP_NO DESC)
WHERE ROWNUM=1;
Is This Answer Correct ? | 14 Yes | 4 No |
Answer / sudipta santra
For the 1st row:
select * from emp where rownum<2 order by empno;
For the last row:
select * from emp where rownum<2 order by empno desc;
Is This Answer Correct ? | 14 Yes | 5 No |
Answer / nathan
SELECT *
FROM (SELECT emp.*, ROWNUM rn
FROM emp)
WHERE rn = 1 OR rn = (SELECT COUNT (*)
FROM emp);
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rajesh
SELECT * FROM (SELECT * FROM EMP ORDER BY EMP_NO) WHERE
ROWNUM < 2
UNION
SELECT * FROM (SELECT * FROM EMP ORDER BY EMP_NO DESC)
WHERE ROWNUM < 2;
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ajay reddy
Select * from (select e.*,rownum r from emp e) where r in(1,(select count(*) from emp));
Is This Answer Correct ? | 0 Yes | 0 No |
what are different types of locks?
What language does oracle use?
What are the commands youd issue to show the explain plan for select
What are the common oracle dba tasks?
How to load excel data sheet to oracle database
if you ctreate table identity
Please send me Informatica 8.1 certification dumps, my mail id mona85gupta@gmail.com
Explain the concept of the DUAL table.
Can group functions be mixed with non-group selection fields?
What are advantages fo Stored Procedures?
Explain oracle left join with an example?
What are dml statements in oracle?