-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Saturday 19 July 2003 19:20, Jim McAtee wrote:
> Interesting. In the case where you want to begin numbering existing rows
> at 1,
>
> is it necessary to set the autoincrement number to that of the next, i.e:
> > Alter Table X Auto_Increment = 201;
No. If you don't specify an autoincrement seed, it will start numbering at 1
and go forward (e.g. 1 is the default). The existing rows will be numbered
from 1 forward (in your case from 1-200). Then, when you add the next row, it
will be given the next number in sequence.
>
> or do you just go in, create a column with autoincrement set and wait a bit
> for the table to be numbered?
Exactly.
> What criteria will MySQL use to number the existing rows? Does it know the
> chronological order of these rows (based on physical position in the
> file?), or would the numbering essentially be unpredictable?
It starts at the base (default 1) and numbers forward. The only exception
would be if you manually specify a number for the auto-increment column that
would clash with the next number in sequence. For example:
Assume you have your 200 columns numbered from 1-200. Your table is "tbl" and
the only field is the autoincrement column "fld". You enter the following
Insert into tbl Values(null);
fld will be set to 201 (the next number in sequence. You then enter the
following:
Insert into tbl Values(202);
Insert into tbl Values(null);
This creates 2 records. The first has fld set to 202 (that's what you said).
The next has fld set to 203 (the next number in sequence).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/GeOHjeziQOokQnARAlL3AJ42TGWokZnvVJHNYblsxbnHG+cpagCfcGm0
XFnL+EI8ckce1s7lKKnV4d0=
=75p8
-----END PGP SIGNATURE-----
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]