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 / sudipta
u may try this
assuming table 'tab1' has 2 fields id & name
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)
u try these & if any problem u may write
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is the default page size of buffer pools?
What is buffer pool in the db2 database?
What is view db2?
Hi Everyone... Under the Logical files, when am working on multiple rec format logical file, I have joined two pf's using the multiple record format logical file concept, but when i run queried the LF only the first mentioned pf records are reflecting and I am not able to see any of the field records specified under the second pf. Kindly let me know whats the reason behind this. Below is the str of LF., R rec PFILE(LOGICAA) CUSTNO CUSTNAME BILL K CUSTNO R rec1 PFILE(LOGICAA1) CUSTNO ADD K CUSTNO .....
What is the function of logging in the db2 database?
What is role in db2?
How do I add a column to an existing table in db2?
How would the varchar column remarks defined?
What is the physical storage length of the data types: date, time, timestamp in the db2 database?
What is catalog database in db2?
What is the use of reorg in db2?
I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.
How to create db2 table in mainframe?
List out the three types of page locks that can be held.
What kind of database is db2?