I am following an online tutorial that gets you to create a mysql db. Initially you insert a category that has a parents id field. It then gets you to update the first entry so that the auto increment is set to zero. That works fine but when you go to insert new records it starts auto numbering from 2. Why does this happen and is there a way around this?
Cheers
It's not weird ;) - It's the way it should work. The auto_increment does not neccessarily increment like 1,2,3 etc...
If you delete entries you'll find more like you've described when you add entries again...
I'm sure someone else will describe it better but, for now, just rest assured that all is well :)
Nick
An integer column may have the additional attribute AUTO_INCREMENT. When you insert a value of NULL (recommended) or 0 into an AUTO_INCREMENT column, the column is set to value+1, where value is the largest value for the column currently in the table. AUTO_INCREMENT sequences begin with 1. [...] If you delete the row containing the maximum value for an AUTO_INCREMENT column, the value will be reused with an ISAM, or BDB table but not with a MyISAM or InnoDB table. If you delete all rows in the table with DELETE FROM table_name (without a WHERE) in AUTOCOMMIT mode, the sequence starts over for all table types.
[mysql.com...]
You are always on the job Andreas!
Quite literally so, or at least I hope to be in a couple of weeks. I´m working on an application for a job right now ;).
Andreas
Good luck Andreas - what a combination of skills - a programmer with a law degree! Who'd a thunk it. ;)
[edited by: jatar_k at 3:08 pm (utc) on Feb. 10, 2003]
[edit reason] delinked [/edit]