Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Hi Everyone,
How to get fist and last record from a table in oracle?

Thanks in advance

Answer Posted / venkyhulk1

select *
from (select rownum r, e.* from emp e)
where r in ((select max(rownum) from (select rownum , e.*
from emp e)),(select min(rownum) from (select rownum , e.*
from emp e)))


this querry will get the first and last records of the table
with respect to the way the data is stored in the table

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sqlerrd?

971


what is the difference between join and union? : Sql dba

1122


what is a primary key? : Sql dba

1040


What is difference between mysql and postgresql?

1161


Is sql low level language?

1023


Is left join same as join?

999


What is the main difference between sql and pl/sql?

1103


What is information schema in sql?

1078


Can we insert data into materialized view?

951


Explain spool.

1186


What is scope of pl sql developer in future?

1026


how to create a new table by selecting rows from another table in mysql? : Sql dba

1113


What is sql*loader and what is it used for?

1158


what are the advantages a stored procedure? : Sql dba

980


Why commit is not used in triggers?

1046