News:

The "Support Requests" forum is now viewable by guests.

Main Menu

mysql auto_increment

Started by westsida, March 14, 2006, 11:06:11 AM

Previous topic - Next topic

westsida

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....

Evilsprouts

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

Ben

ALTER TABLE `TABLE_NAME`  AUTO_INCREMENT = WHATEVER

Just run that query.
--Ben
Ben@freepgs.com

webzone (archived)

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.