[thelist] database eating brain...

rudy limeback r937 at interlog.com
Tue Jul 4 22:21:09 CDT 2000


hi david

>... how is it that you have more than one item marked
> as the primary key in the tables above? I thought each table
> could only have one primary key. Does that mean that they're
> primary keys in a different table? If so, could they also be listed
> as foreign keys?

a primary key is *one or more* columns that determine row uniqueness

when the table has an autonumber primary key, it's gonna be unique, that's
one (of several) of the attractions of using autonumber pks

but you certainly may have a primary key which consists of several columns

for example, city alone wouldn't be a good primary key, you'd want city
plus state (miami florida, miami ohio)

remember, the main purpose of a primary key is not uniqueness -- uniqueness
is a necessary condition, true, but if uniqueness is all you want, just
declare a unique index on the column... you can do this on as many columns
as you wish, too..

no, the main reason you designate a primary key is so that you can have
other tables with foreign keys that refer to it

yes, this means that the foreign key would consist of multiple columns
whenever the primary key does

which is why autonumbers are attractive, you don't have to carry multiple
columns in the related table


as to your design, http://www.alaska.net/~mccreath/sdfs.html (nice layout,
by the way) --

the naToolsUsed table looks like it's going to allow multiple tools per
grant -- is this true?  if it's just one tool per grant, you can stuff both
naToolDesc and naToolID into the grant table -- the part i can't figure out
is how the multiple tools per grant in naToolsUsed exist separately from
the multiple tools per grant in genGoalsTools... furthermore, unless each
goal can have multiple tools, you can probably absorb genGoalsTools into
genGoals

i guess i'm still somewhat confused, but i think your next reply will nail
it down...


rudy.limeback
r937.com
evolt.org






More information about the thelist mailing list