List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 31 2001 11:42pm
Subject:Re: Auto_increment
View as plain text  
At 2:03 PM +0100 10/31/01, Ireneusz Piasecki wrote:
>HI everybody.
>
>I saw, when i delete all records from the table where id
>is primary key and auto_increment, the first number for id is'nt 1 but next
>in a row (the last was 5 the next will be 6).
>
>Can i change this behavior ? Mybe in file my.ini ?
>The goal is, that when i delete all records from the table  the id field
>begin with 1, when i insert a record.
>
>I use 3.23.43-max on win98, the table is myisam type.
>
>regards. I. Piasecki.

What you observe is what will happen if you delete records using
DELETE statements that have a WHERE clause.

If you empty the entire table at once like this:

DELETE FROM tbl_name

then the AUTO_INCREMENT value will reset to 1.

This is true for MyISAM tables, not necessarily for other table types.
Thread
Auto_incrementIreneusz Piasecki31 Oct
  • Re: Auto_incrementPaul DuBois1 Nov
  • INSERT ... SELECT and VALUES? Is this possible?Nathan1 Nov
    • Re: INSERT ... SELECT and VALUES? Is this possible?Paul DuBois1 Nov
  • Re: Auto_incrementIreneusz Piasecki5 Nov
Re: Auto_incrementHeikki Tuuri5 Nov