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...

How will fetch last 5 rows from table in db2

Answer Posted / sree

SELECT * FROM TABLENAME ORDER BY PRIMARYCOLUMNNAME DESC
FETCH FIRST 5 ROWS ONLY ;

THIS ANSWER IS VALID ONLY IF THERE IS A PRIMARY KEY
COLUMN,OTHERWISE IT WONT WORK

IF THERE IS NO PRIMARY KEY COLUMN IN GIVEN TABLE ,I DON'T
KNOW THE ANSWER

FOR FETCHING FIRST 5 ROWS

SELECT * FROM TABLENAME FETCH FIRST 5 ROWS ONLY;

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use cursor?

1106


What is declare cursor?

1127


What is the use of value function?

1153


Can we delete records from view?

970


How do you concatenate the firstname and lastname from emp table to give a complete name?

1077


What is a db2 package?

1065


What is bind in db2?

1053


What is rebind in db2?

1071


What's The Error Code For Unique Index Voilation?

1241


Is db2 a database?

979


What is innodb buffer pool?

1063


What is query_cache_limit?

977


What is the function of logging in the db2 database?

1123


What is clone table?

1052


How do I delete a column in db2?

1112