Hi Eric

I dunno why people make 100 field tables, sounds a little harsh. I'll keep 
you in mind the next time i wanna make a 100 field table.

Anyways, just to let you know mysql 4 will be supporting foreign key 
constraints. And yes thoes other db technologies like postGrep already 
support key constraints, but i thought (and correct me if i'm wrong) that 
mysql just performs a little better (maybe because of having no key 
constraints). But regardless of mysql not supporting foreign keys, i still 
put them in the defenitions of my tables because i believe it's good for 
documentation and also if we upgrade to mysql 4 things will be less painful 
when updating tables to use foreign keys.

>Is it such a big deal to use more than one field for a primary key? Two
>field keys are only a little slower than single field Primary keys for
>selects. Often in linking tables you want to have duplicates of the two
>foreign keys right?

Not quite sure what you mean by having duplicates of a foreign key. I'm 
guessing you mean something like this in a linking table:

Linking table
______________
authorID, bookID


Author table
_____________
authorID, firsname, lastname, ...


Book table
___________
bookID, name, pubDate, ....

Thus the linking table will have a primary key of authorID and the bookID to 
uniquely id the row in the linking table. However, you can have this:

LInking table
_____________
6, 1
7, 1

Author table
_____________
6, Puff, Daddy, ...
7, keanu, reves, ...

Book table
___________
1, Bad acting and rapping cross over, 2000, ....

Thus, the book "Bad acting and rapping cross over" is written by Both Puff 
and Keanu. Therefore you have multiple entries of the book with id 1 in the 
table. It appears 2 times on 2 different rows, but 2 times within the same 
column. (My apologies to keanu and puffy fans out there).

Good luck with the 100 field tables, and thanks for your reply and all the 
other replies out there for this message. I'm glad to know that i'm not the 
only one that thinks having no primary key is NOT a good idea. I'll be sure 
to give my collegue a mouthful if he bitches about primary keys again.

Thanks

Desmond

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to