Re: adding an auto-incrementing id field to an existing database
| From: | Paul DuBois | Date: | Tue, 04 Dec 2001 16:51:06 +0000 |
| Subject: | Re: adding an auto-incrementing id field to an existing database | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14812@lists.php.net to get a copy of this message | ||
At 7:08 PM -0800 12/3/01, chip wrote:
I have an existing database, created a while back, which I need to add a id field to, there isn't one currently. Will simply adding a new auto-increment field be okay? Will the existing rows receive id numbers and will they be numbered properly? Or will it start with the new data and continue from there? I hope you know what I mean. -- ChipIf you're using MySQL, adding an AUTO_INCREMENT column will cause the column values to be numbered sequentially in the existing rows. Whether they will be "numbered properly", I have no idea, because yo don't define "properly". :-)