MySQL Forums
Forum List  »  Newbie

Re: Delete exactly the third row in database
Posted by: Andrew Gilfrin
Date: July 22, 2005 11:53AM

"Have I deleted the third record?"

The thing is in this example is that it doesn't matter, the rows are all the same so it's not important which one you delete.

Here's why you don't want to rely on insertion order as you ordering method.

mysql> select * from test_delete;
+------+
| num |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.00 sec)

mysql> delete from test_delete where num = 3;
Query OK, 1 row affected (0.00 sec)

mysql> insert into test_delete values (6);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test_delete;
+------+
| num |
+------+
| 1 |
| 2 |
| 6 |
| 4 |
| 5 |
+------+
5 rows in set (0.00 sec)

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


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


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.