quary for
1> fetch last record
2> fetch in reverse order
3> fetch last 5 row
4> fetch second last record (their is no primary key)
i think concept of count can be use for this in 4th

Answer Posted / pavan

please try this one and let me know....


select * from emp where :ws-rec-cnt = (select Count(*)
into :ws-rec-cnt from emp);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you tell me how can you find out the # of rows updated after an update statement?

621


How to take backup of table in db2?

607


DB2 can implement a join in three ways using a merge join, a nested join or a hybrid join. Explain the differences?

2291


How to fetch the last row from the table in SQL (db2)?

1043


How to find primary key of a table in db2?

621






What is reorg and runstats in db2?

703


Define data page.

642


What is the default page size of buffer pools?

655


How do I add a column to an existing table in db2?

601


How can you validate Sql errors during cursor operation in db2 pgms and where do you code?

1720


Mention the various locks that are available in db2.

621


What is a db2 schema?

770


List out the buffer pools in db2

642


What are the full forms of spufi and dclgen and why are they used?

663


Explain what are the various isolation levels possible?

614