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.