Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


In my table having 100 Rec. How can I delete the 7th row??
(we don't know what is data inside the table)

Answers were Sorted based on User's Feedback



In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / harsha

Use DELETE FROM TabName

The above command will delete all rows of the table with
out deleting the table.

Now if we want to delete 7th row and we don't know the
actual data in that row, then in that case we need to
create a new temporary result table, that contains only one
desired record which you want to delete.
Here are the steps.

1 Select only 7 row data.
2 Sort it in descending order(ORDER BY calue)
3 Select only first row
4 Now you have a result table with only 1 and desired record

Is This Answer Correct ?    4 Yes 1 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / mdv

DELETE FROM TABLE_NAME
WHERE RID(TABLE_NAME) = 7 ;


Works DB2 (V9 Onwards)

Is This Answer Correct ?    2 Yes 0 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / giri reddy

use cursor to find out the primary key column value in that
row, then delete tha row using the primary key

Is This Answer Correct ?    1 Yes 1 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / rajeev

In this scenario RRN will be useful.

DELETE FROM <FILENAME> F1 WHERE RRN(F1) = 7

Is This Answer Correct ?    0 Yes 0 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / tim v

Are we talking the 7th row as sorted by key or 7th physical row?   Since the rows aren't normally physically stored in order, I'd have to go with the latter.  

Everyone seems to assume there is a PK on the table, but yet we don't know anything about the data...  Again, this points to 7th physical row.

I'd go with the delete where RID(table) = 7 option since this assumes the 7th row inserted based on position and not value.

Is This Answer Correct ?    0 Yes 0 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / m sharib

delete from table1 where policy_no =(select policy_no from table1 limit 6,1);

Is This Answer Correct ?    0 Yes 0 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / ajay

we need to know atleast 1 column data, else we can not delete data from table.

Is This Answer Correct ?    2 Yes 4 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / raghu

delete count(*) = 7 from tbname

Is This Answer Correct ?    0 Yes 2 No

In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside ..

Answer / sherman_li

Actually, you don't need to delete this data, just move
foward the remaining data(from 8th to 100th), for example,
8th -> 7th
9th -> 8th
...
100th -> 99th

hope this is what you want

Is This Answer Correct ?    0 Yes 11 No

Post New Answer

More DB2 Interview Questions

What is the difference between IN subselects and EXISTS subselect?

1 Answers   HCL, PreVator, TCS,


what is the use of bind parameter, Replace?

5 Answers   IBM,


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

0 Answers  


how do we solve soc 7 and soc4 ?

3 Answers   Tech Mahindra,


how to fetch multiple records without using cursor

14 Answers   HCL,


Can I use LOCK TABLE on a view?

1 Answers  


Is it possible to create an Instance in DB2 using DB2 Control Center ?

0 Answers   MCN Solutions,


What is db2 look?

0 Answers  


Which command is used to remove all rows from a table?

0 Answers  


i have a db2 variable how do u declare tht into working storage section ?

1 Answers   TCS,


What is -904 sql code? How to resolve it?

3 Answers  


I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.

0 Answers   ITC Infotech, Syntel,


Categories