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
What is dbrm? What it contains?
What is dclgen in db2?
before altering a table is it necessary to lock ? if lock what is it ? how to do ? ifi want to lock a table what is that command ?
Mention some fields that are a part of sqlca.
What is copy pending and check pending in db2?
What do you mean by between and in? Is between inclusive of specified range values?
If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?
How do I copy a table in db2?
What are types of indexes?
How is deadlock resolved?
How is the value function used?
What is db2 stogroup?
What is a page in db2?
What parameters are used to control the free space in DB2?
What language is db2 written in?