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 |
how to create a new database in oracle?
Explain the use of rows option in imp command.
Hi friends can u send the oracle 9i full version download link?????????????? please reply ?
Where is the export dump file located?
Please explain me all types of Data models. Also give me the details if each model can have other name.for example:schematic data model is also known as conceptual data model and entity relation data model.
Define Transaction ?
what is the difference between functional dependecy and multilevel dependency?
HOW TO CONVERT ORACLE TABLE DATA (RECORDS)INTO EXCEL SHEEET?
How to do paging with oracle?
Using the relations and the rules set out in the notes under each relation, write table create statements for the relations EMPLOYEE, FIRE and DESPATCH. You should aim to provide each constraint with a formal name, for example table_column_pk.
What is cursor
Explain the dml?