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 null in pl/sql?

1046


how do you tune the slow running queries in oracle db , explain the methodology

2567


Explain what is a column in a table?

1084


what are date and time intervals? : Sql dba

1033


What is cold data?

939


What are the different type of joins in sql?

934


What is union and union all keyword in sql and what are their differences?

1084


Is sql free?

926


How do you create a unique index?

1031


What are different types of queries in sql?

1102


How many columns should be in an index?

950


How to add new employee details in an employee_details table with the following details

1078


What is a subquery in sql?

1020


What are the different types of joins in sql?

1732


What is the use of & in pl sql?

1030