On Thu, 27 Jun 2002, jason wesley upton wrote: > Date: Thu, 27 Jun 2002 14:05:34 -0500 > From: jason wesley upton <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: MySQL Question involving AUTO INCREMENT and PRIMARY IDs. - sql > > EXPLANATION: > > here's the pertinent piece of my sql create statement: > > ID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID)); > > i have used this create statement numerous times without this "problem". in the >past, let's say i inserted 3 entries: A, B, and C. their IDs were 1,2, and > 3. then i delete C from the database. when i then insert D its ID is 4. leaving >1,2, and 4 in the database. seems like this is safe and as it should be. > > all this morning, using the above example with a deviation...after i delete C and >then insert D...D's ID is 3. if i delete B and C, then insert D and E...their > ID's are 2 and 3. > > i was under the impression that once an ID had been used (in auto increment and as >primary) it was gone. must i also make the ID "unique"? i can see > why a primary key might need to be not UNIQUE (for concatenation of entries...etc), >but i don't think i've done it iN the past (when it has incremented > correctly). Depends a bit on table type: ISAM files will reuse the ID if the deleted record has the highest ID in the database. MYISAM does not AFAIK.
> > > > thanks ahead of time. query sql for the filter. > > > > jason wesley upton > > > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > Sincerely, William Mussatto, Senior Systems Engineer CyberStrategies, Inc ph. 909-920-9154 ext. 27 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php