List:General Discussion« Previous MessageNext Message »
From:David T-G Date:January 28 2003 12:10pm
Subject:Re: question about primary key
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincente, et al --

...and then Vicente Valero said...
% 
% Hello, I need help.

Hi!  That's why the list is here :-)


% 
% I want to create a table with a numeric primary key as index in my sql. I

Good.


% want this
% index will be automatic. I've tried an auto_increment column, but if insert

Also good.


% a non-correlative value then all new entries continue from this
% non-correlative value (1,2,3,4,1026,1027,...). It is possible use the first

Aha!  There's your problem.  Don't specify values into an auto_increment
column; let the database handle it itself.  If you need to track some
other sort of id, like 1026 or 1000, then put that in another column
(which might be empty if there's no value to track).  Don't overload the
primary key, which should simply be a unique row identifier, by asking it
to hold row data as well.


% value not-used in the column automatically (1,2,3,1026,4,5,1000,6,7,...)?

Nope.


% 
% Thank you,
% Vicente


HTH & HAND

mysql query,
:-D
- -- 
David T-G                      * There is too much animal courage in 
(play) davidtg@stripped * society and not sufficient moral courage.
(work) davidtgwork@stripped  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE+NnNRGb7uCXufRwARApd7AJ9bF2tJJZgcS5WIw5Xxj03iVcXthACg4CDc
QUDmZnRb8FcXWaJrUB5Xe84=
=KQeg
-----END PGP SIGNATURE-----
Thread
question about primary keyVicente Valero27 Jan
  • re: question about primary keyVictoria Reznichenko28 Jan
    • mysql dump for remote dbMark Stringham28 Jan
      • Re: mysql dump for remote dbNicholas Stuart28 Jan
      • Re: mysql dump for remote dbZak Greant28 Jan
      • Re: mysql dump for remote dbDavid T-G29 Jan
  • Re: question about primary keyDavid T-G28 Jan
Re: mysql dump for remote dbDan Nelson28 Jan
Re: mysql dump for remote dbMark Stringham29 Jan
  • Re: mysql dump for remote dbDavid T-G29 Jan
Re: mysql dump for remote dbMark Stringham29 Jan