/ Published in: SQL
URL: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
If you are deleting all the rows in a table and you also want to reset the values that will get used by auto increment, this is how to do it.
Expand |
Embed | Plain Text
ALTER TABLE tbl AUTO_INCREMENT = 1;
Comments
Subscribe to comments
You need to login to post a comment.

If you have already deleted all rows from table, you can truncate it. Effect will be the same. Also you can use truncate instead of using delete. Then you can do the same thing with one query.