How to retrieve first and last records from a table?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I escape a reserved word in oracle?

622


Can we create trigger on materialized view in oracle?

556


Why do we need integrity constraints in a database?

578


How do I limit the number of rows returned by an oracle query after ordering?

616


what is the dual table in oracle?

548






normally database take to refresh time 2 hours. but client asked iwant to refresh with in 5 min that same database. do you have any option in BO and Oracle? explain me briefly...kavi

1733


What to do if the startbd.bat failed to start the xe instance?

603


What is bulk copy or bcp in oracle?

600


How to rebuild an index in oracle?

543


What is oracle used for?

527


What is the order of defining local variables and sub procedures/functions?

591


what's query optimization and without use of IN AND Exist can we get another way data from query

1659


Why do I get unexpected characters from 8-bit character sets in weblogic jdriver for oracle?

602


What is the difference between view and materialized view in Oracle?

599


Explain cascading triggers.

568