i have a table like this :
Name ADDRESS
Toto 123 ...
Toto 456
ToTo 678

I would like to delete 2 last row...please tell me how to
delete its

Answers were Sorted based on User's Feedback



i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I..

Answer / mithlesh

delete from table_name
where address = '456' and '678'.

Is This Answer Correct ?    10 Yes 4 No

i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I..

Answer / siri

DELETE FROM TABLE WHERE ADDRESS IN('456','678')

Is This Answer Correct ?    2 Yes 0 No

i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I..

Answer / prashant shettar

delete from (select rownumber() over() as rowid from tab1 )
where rowid = ( (select count(*) from tab1) - 1)

Is This Answer Correct ?    2 Yes 1 No

i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I..

Answer / suv

We can use concept of cursor to delete particular row. The
row where the cursor is pointing will get deleted.

Please correct is wrong..

Is This Answer Correct ?    0 Yes 1 No

i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I..

Answer / vaneesh khurana

I think better to perform this in following 2 queries

1. Select count(WS-COUNT) from TABLE;

2. DELETE FROM TABLE WHERE ROWCOUNT(*) IS WS-COUNT OR
(WS-COUNT-1);

Basically here the first row will give you the record count
and 2nd will delete the last and the 2nd last row.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More DB2 Interview Questions

List out the buffer pools in db2

0 Answers  


What is the purpose of the QUIESE Utility?

1 Answers  


Why do we use cursor?

0 Answers  


what's the error code for Unique Index Violation?

2 Answers  


Select empno, sal from emptbl where empno < 101.By this query can we fetch first 100 recs? where empno is primary key.It won't throw -811 error? if it wont,then what is use of cursor technique while fetching first 100 recs. Please need more clarification.

2 Answers  






Following a db2 update statement, what is the quickest way to compute the total number of updated rows?

0 Answers  


When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?

0 Answers   Broadridge,


What is cobol db2?

0 Answers  


why db2 is called as universal database?what is the storage capacity of db2v9 n what are the advantages of db2

3 Answers  


What is buffrpool? Where we use it ?

2 Answers   Tesco,


What are iseries servers?

0 Answers  


How do you leave the cursor open after issuing a COMMIT? (for DB2 2.3 or above only)

2 Answers  


Categories