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

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the table of which 3 have a null value in the dept column, what will select count(*) and select count(distinct dept) return?

6 Answers  


How and when does the db2 enforces the unique key?

0 Answers  


Lot of updates have been done on a table due to which indexes have gone haywire. What do you do?

2 Answers  


Define predicate?

0 Answers  


Suppose the outcome of executing a query results in a row having null. Based on the answer how you use it? Its declaration and inclusion?

2 Answers   Verizon,






Which are the db2 tools to protect integrity of the database?

0 Answers   IBM,


What is a DB2 plan?

8 Answers  


What are packages in db2?

0 Answers  


What is the max length of sqlca?

0 Answers  


difference between group clause and order clause

1 Answers  


How do you filter out the rows retrieved from a Db2 table ?

1 Answers  


What is FREEPAGE and PCTFREE in TABLESPACE creation?

1 Answers  


Categories