Hi Ted,

Any single primary key cannot contain duplicate entries and any single table
can have only one primary key. With your example, 'table1.people_id' can
have values "1" - "50" and 'table2.location_id' have "1" - "50 at the same
time  so your final statment is wrong. I assume what the book actually means
is that you cannot have, for example, two "1"'s in the same primary key.
Trying to insert a new "1" will cause an error. But, if you've chosen it to
be auto_increment, then this shouldn't be a problem.
Hope that helps.
Best wishes,
Paul Najman [EMAIL PROTECTED]
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "MySQL List" <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 8:19 PM
Subject: database newbie


> Ok, since this is THE place for MySQL and related discussion/questions,
> here goes:
>
> I'm trying to understand Keys, I do for the most part, but in reading
> the well recommended book 'Database Design for Mere Mortals' I got a
> bit confused.
>
> A check for worthy primary key designation is to ask what fields are
> "indirectly" identified by the PK, then the book says to slash such a
> field --I suppose later to put it into a separate or subset table;
> however, turning the page, the field is there and never removed from
> the final version of the book's example table.
> (If you have this book it is Chap. 8, pgs. 224-226.)
>
> Next, again from reading this book, I am told that when i create
> Primary Keys manually (or artificially, i.e., not naturally occurring
> fields) e.g., making a field called 'table1.people_id' as my Primary
> Key (auto-incrementing), and in another table the Primary Key
> 'table2.location_id' (auto-incrementing), the book leads me to believe
> that each of these *two table's Primary Key's field values cannot be
> the same*.
> that is, that if the values for the field 'table1.people_id' rows is
> "1" - "50", then the field values for 'table2.location_id' (or any
> other table) cannot also be "1" - "50".
>
> Huh???  Is that long winded stuff I just wrote simply wrong?  (I think
> it is, but need clarity.)  *If it is correct, then how is such a thing
> accomplished?
>
> Thanks.
> Ted
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to