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
Give a brief description of db2 isolation levels?
What is explain plan in db2?
What is the usage of open cursor command?
How do I add a column in db2?
What is rebind in db2?
What is a db2 schema?
What is commit in db2?
What parameters are used to control the free space in DB2?
What is the result of open cursor statement?
Which components manage deadlocks in db2?
What is the difference between spufi and qmf?
Is db2 free?
What are the uses of db2 optimizer?
What are the various data types available in db2?
Which command is used to remove all rows from a table?