|
|
 |
Re: FN-FORUM: Mysql syntax help
date posted 2nd May 2008 08:16
Quoting Dom Latter [EMAIL REMOVED]
>
> Or that the code is moved to an (MySQL or otherwise) engine that does
> re-use IDs, or issue them out of order. Moving the database to another
> server might also muck up your IDs.
If you're moving servers then so long as you export the SQL in =20
order to import it again, the table construct SQL will include the =20
AUTO_INCREMENT [xxx] as part of that definition, so it shouldn't muck =20
up the auto_increments at that point either.
>
> I've not seen anything in the docs that says that the MySQL engine
> MUST issue IDs in order, without re-use. If anybody can find something
> like that, I'd be very interested.
>
MySQL will re-use the *row*, but not the ID (unless explicitly =20
requested to do so) on an auto_increment field. If you create a table =20
with an auto_increment field called ID, and add ten rows to it, then =20
delete (f'rexample) records 5 and 8 , when it comes to inserting a new =20
record, it'll still have the ID of 11, but it will go in to the space =20
where record 5 was. If you then do a simple browse of the table in =20
PHPMyAdmin, you'll see what I mean. But it'll still have the correct =20
ID, and thus sort fine using that ID column.
Alex
http://www.ozbon.com
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
> |
 |
|