No, this was perfect. I had totally misread (I figured out after I bothered everyone!) --it was I had always been taught and as you say.

I hope you have seen my most recent question to the list? About manually entering the data? The short and sweet answer there be that someone ALWAYS has to enter ALL the data, that the database is for retreival of what has been put in, manually. though the db can do a lot fancy footwork ;-).

Now about foreign keys: I have updated MySQL to 4.0.12 and changed my tables to InnoDB, because someone said that is where this might be leading! i.e., I don't know. I do know, or think I do, that MySQL does NOT have/handle Foreign Keys. So what do I do?

Thanks Ted


On Friday, May 30, 2003, at 04:58 AM, Becoming Digital wrote:


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".

I think you're mis-interpreting the use of "values." While the actual value can
be the same between the fields (1, 11, 40, etc.), what it signifies must differ.
THe important thing is that the two keys are in no way dependant on anything
else in the database. Here's an example.


Say you're developing a catalogue of books. The database needs at least two
tables: books and authors. Each of them will have an id field (book_id,
author_id) to be used as the primary key. (In addition, the books table will
have an author_id field as a foreign key, but this is a discussion for later).
If you have 50 books in your DB with 25 different authors, there will inevitably
be some overlap in the id field values. However, because neither field is
directly linked to the other, this is not an issue.


I apologise if this isn't the best explanation. I'm one of the world's worst
teachers, and the fact that it's nearly 05:00 isn't helping that.


Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message ----- From: <[EMAIL PROTECTED]> To: "MySQL List" <[EMAIL PROTECTED]> Sent: Thursday, 29 May, 2003 15:19 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