[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Auto_increment
From:       Paul DuBois <paul () snake ! net>
Date:       2001-10-31 23:42:01
[Download RAW message or body]

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.

---------------------------------------------------------------------
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 <mysql-thread89684@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic