FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: westsida on March 14, 2006, 11:06:11 AM

Title: mysql auto_increment
Post by: westsida on March 14, 2006, 11:06:11 AM
Hey guys in mysql i set a column named 'id' as 'id int auto_increment primary key'...

Now lets say I insert five rows..

1   xxx
2   xxx
3   xxx
4   xxx
5   xxx


If i 'delete from table' to delete all rows and I add another five rows, it will look like this..

6   xxx
7   xxx
8   xxx
9   xxx
10 xxx

This is a problem for me, I want it to start over.. I forgot what the attribute was but it's something that needs to be put in with 'id int auto_increment primary key'..

Please help with this issue.. thanks....
Title: Re: mysql auto_increment
Post by: Evilsprouts on March 14, 2006, 11:11:08 AM
What query do you use to delete the rows?

I THINK that if you use TRUNCATE it will start over but if you use DELETE it won't.


Correct me if I'm wrong which I most likely am.

Jack
Title: Re: mysql auto_increment
Post by: Ben on March 14, 2006, 04:12:56 PM
ALTER TABLE `TABLE_NAME`  AUTO_INCREMENT = WHATEVER

Just run that query.
Title: Re: mysql auto_increment
Post by: webzone (archived) on March 14, 2006, 08:59:23 PM
QuoteI THINK that if you use TRUNCATE it will start over but if you use DELETE it won't.

"TRUNCATE TABLE sometable" resets the auto_increment to zero, so you are not wrong.