MySQL Forums
Forum List  »  Newbie

Re: Delete exactly the third row in database
Posted by: Shantanu Oak
Date: July 22, 2005 10:08AM

select count(*) from test;
7

delete from test where a = 'x' and b = 'y' limit 1;

select count(*) from test;
6

Have I deleted the third record? I can't prove it. But you can't prove it otherwise either!
Why not to add a primary key to the table like this...

ALTER TABLE test ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;

Now you can do exactly what you are trying to do...

delete from test where id = 6;

Options: ReplyQuote


Subject
Written By
Posted
Re: Delete exactly the third row in database
July 22, 2005 10:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.