List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:July 23 1999 7:24pm
Subject:Re: auto_increment & table duplication
View as plain text  
At 14:25, 19990723, Marc Antony Vose wrote:
>my question is this:  what happens to the auto_incremented int when a 
>record is deleted from the table?

auto_increment only matters when you're inserting a new row, and you
specify NULL (or 0) as the value for the auto_increment field.  In
that case, the value will be MAX(Field)+1.  So if you delete the record
with the highest value of Field, then on the next insert that value will
be reused.  Otherwise there is nothing weird.

This behaviour is scheduled to change at some time in the future.

>i looked through the manual and didn't see anything like 
>there a command for duplicating a table?

There is a plan to make a statement like:

CREATE TABLE some_table LIKE other_table;

That would recreate the exact schema of other_table (like

$ mysqldump -d db other_table | \
  sed -e 's/TABLE other_table/TABLE some_table/' | \
  mysql db

I don't know when that will be implemented.

auto_increment & table duplicationMarc Antony Vose23 Jul
  • Re: auto_increment & table duplicationThimble Smith23 Jul
    • Re: auto_increment & table duplicationPaul DuBois23 Jul