At 9:57 PM -0400 4/27/1999, Dave Crawford wrote:
>I have a small table as follows:
>+--------+--------------+------+-----+---------+----------------+
>| Field | Type | Null | Key | Default | Extra |
>+--------+--------------+------+-----+---------+----------------+
>| ID | int(11) | | PRI | 0 | auto_increment |
>| name | varchar(25) | YES | | NULL | |
>| state | char(2) | YES | | NULL | |
>+--------+--------------+------+-----+---------+----------------+
>
>I had 50 some records inserted and was testing some delete commands:
>
>delete from table where (ID > 40);
>
>When I did a 'select * from table' I noticed that the remaining
>records had their ID's renumbered starting from 1. Is this a bug?
>The manual state's "If you delete the row containing the maximum
>value for an AUTO_INCREMENT column, the value will be reused. If
>you delete all rows in the table, the sequence starts over." But
>I didn't delete all the rows, so why did it renumber them? Normally
>it wouldn't be a big deal but I'm assigning a 'User #' that correlates
>to
>the ID number, so I need the ID column to always remain relative to the
>original record. Thanks in advance.
I don't see the problem. When you inserted the rows, presumably
the ID fields were set to values from 1 to 50. You only deleted
rows with ID > 40, so the remaining records would be those with
ID values from 1 to 40. They weren't renumbered at all.
--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/