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

What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?

1234


Can one database have multiple instances?

1097


How do I add a column in db2?

1090


What is buffer pool in the db2 database?

1155


How to get the ddl of a table in db2?

1168


How is the value function used?

1207


What is a plan and package in db2?

1153


Before you give the explain statement, what are the prerogatives?

1081


If anyone has IBM Certification Dumps pls forward to me & also let me know what are the Certification Codes that are available in DB2

2091


How does cobol compile db2 program?

1128


List some fields from sqlca?

1107


What is the difference between cursor stability and repeatable read isolation levels?

1238


What are the different types of base tables?

1163


What is the use of with ur in db2?

1108


What is db2? Explain.

1109