Jump to content

Behavior of MySQL...


elmas156

Recommended Posts

Just a quick question about the behavior of MySQL when a field is set for auto increment... Lets say there are 100 entries with id numbers 1-100.  If random entries are deleted from the table, then one is later re-entered with the same id number manually inserted rather than allowing the AI to assign a new number, will the next AI id number always be 101 or would it ever go to the next available number after the manually re-entered id number?

I hope I explained that correctly...

 

On a smaller scale, here's an illustration:

 

id

1

2

3

4

5

 

id 2, 3, and 4 are deleted leaving this:

 

id

1

5

 

if id 2 is re-inserted manually rather than allowing the auto increment to assign id 6, will the next auto increment id number continue at 6 or will it ever use the next available number, in this case, 3?

 

id

1

2 - inserted manually

5

(3 or 6?) - new auto increment number

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/212794-behavior-of-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.