onday, October 20, 2003 2:34 PM
To: [EMAIL PROTECTED]
Subject: Re: Newbie - Primary Keys
Good points Patrick. Thanks for the follow-up :-)
--- Patrick Shoaf <[EMAIL PROTECTED]> wrote:
-
Mark is correct, you can define only 1 Primary Key,
but the primary keycan be
Good points Patrick. Thanks for the follow-up :-)
--- Patrick Shoaf <[EMAIL PROTECTED]> wrote:
-
Mark is correct, you can define only 1 Primary Key,
but the primary keycan be made up of multiple fields.
Example:
CREATE TABLE test (item_code char(5) NOT
NULL,item_
BTW Carlos,
I'm not sure why you would want or need two primary
keys in a table, but if find you truly do (as opposed
to a PK and some other unique index/key) - there is
probably something wrong with your database design.
You may need to rethink your design. Do some research
and reading on the to
Hi Carlos,
You can't have 2 primary keys. A table can only have
one primary key. You can, however, also define a
Unique key, and if you set it up such that it is not
null, it will act much like a prmary key:
CREATE TABLE test
( id1 INT UNSIGNED NOT NULL,
PRIMARY KEY (id1),
id2 INT UNSIG