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 / sarath

1) select id,name from tab1 order by id desc fetch first
row only
2) select id,name from tab1 order by id desc
3) select id,name from tab1 order by id desc fetch first 5
rows only
4) select id,count(*),name from tab1 order by id where count
(*) = (select count(*) from tab1)-1

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

656


What are the two types of logging in the db2 database? Explain them.

580


What is the difference between using bind () and rebind () methods of naming class?

792


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

1578


What is buffer pool in the db2 database?

616






List down the types of triggers in the db2 database?

590


What is multi row fetch in db2?

605


What is access path in db2?

562


What is buffer pool and list some of them?

630


How do you simulate the explain of an embedded sql statement in spufi/qmf?

634


What are the various isolation levels possible?

649


What is the use of dclgen in db2?

588


How can we retrieve the total number of records in RPG & CLLE?

197


What are iseries servers?

566


What types of tables are there in the db2 database?

554