Re: Autoincrement Question

From: Date: Thu, 10 May 2001 19:07:58 +0000
Subject: Re: Autoincrement Question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9226@lists.php.net to get a copy of this message
In article <safa95c4.095@alliancetechnologies.net>, Tollerson@alliancetechnologies.net ("Angie Tollerson") wrote: > I will be 3 Jeff :) > > > >>> "Jeff Oien" <jeff@webdesigns1.com> 05/10/01 01:13PM >>> > If I have a database that has three records and I delete the entire > third record, when another record is then added will the auto increment > number be 3 or 4? Thanks. Only if the auto_increment values started at zero. Otherwise, the number will be 4. In answer to the question the poster seems to really be asking: auto_increment doesn't go back and re-use values from deleted rows. What if you have data in other tables where a foreign key ties (undeleted) data in that table to the deleted row in the first table? If the value was re-used, then the data in the second table would suddenly be establishing a bogus relationship to the new data in the first. -- CC

« previous php.db (#9226) next »