Re: how to relate tables with two primary keys On Sun, 30 Sep 2007 21:25:20 +0100, "Paul Lautman"
<paul.lautman@btinternet.com> wrote:
>shadkeene@hotmail.com wrote:
>>
>> Hello sir, I know some sql syntax, so I've started from the beginning
>> already with mysql/database design. Of course, I'm by no means even
>> at an average level of database knowledge. But I've read several
>> articles on using composite primary keys...mysql allows me to do
>> that. The data I'm tracking seems like it needs composite primary
>> keys in order to provide uniqueness to each row of data. Also, most
>> of the tables/database examples that I've looked at seem to be using
>> more ID numbers than dated/timed data. So, I guess what I'm getting
>> at is trying to get advice on how I might arrange the other part of
>> the composite key (times) so I can relate the tables together. If
>> I'm way off, so be it.
>> Shad
>
>Tables can certainly have composite primary keys. But they can not have two
>primary keys ,which is what you were suggesting.
Just an addition: Apart from a (composite) primary key, any
table can have other keys by adding UNIQUE indexes.
These can be referred to by foreign keys in any related tables.
It's also possible to define a primary key on one column and a
UNIQUE constraint (index) on one or more other columns.
my 2 cents
--
( Kees
)
c[_] Like a lot of husbands throughout history, Mr. Webster would sit
down and try to talk to his wife. As soon as he'd say something
though, she'd fire back with, "And just what the hell is THAT
supposed to mean?" Thus, Webster's Dictionary was born. (#6) |