How to retrieve first and last records from a table?
Answers were Sorted based on User's Feedback
Answer / naveen
SELECT * FROM EMP WHERE ROWID IN(SELECT MIN(ROWID) FROM EMP)
UNION ALL
SELECT * FROM EMP WHERE ROWID IN(SELECT MAX(ROWID) FROM EMP);
| Is This Answer Correct ? | 22 Yes | 0 No |
Answer / girija.112
select *
from employees
where rowid = (select max(rowid)
from employees)
or rowid =(select min(rowid)
from employees)
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / avnish srivastava-test engg fc
select* from employees where rowid=(select min(rowid) from
employees)
union
select* from employees where rowid=(select max(rowid) from
employees)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ganesh
hi Avnish Srivastava-test Engg Fc
plssssssss can u send the data base testing material
my mail id.... gan9000@gmail.com
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / reddy
select*from emp where rowid in (select min(rowid),max(rowid) from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Why does Oracle not permit the use of PCTUSED with indexes?
Is there a combination of "like" and "in" in sql?
Can select statements be used on views in oracle?
What is connection pool in oracle?
What are the factors causing the reparsing of SQL statements in SGA?
What is COST-based approach to optimization ?
What happens internally when the user types userID/password@string in SQL PLUS Thanks-Bhaskar
What is difference between UNIQUE constraint and PRIMARY KEY constraint ?
What is oracle rowcount?
What are the different type of Segments ?
What are the parameters that we can pass through a stored procedure?
In Oracle 9i what does "i" Stands for?