Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.