[thelist] database eating brain...

David McCreath mccreath at alaska.net
Wed Jul 5 10:31:39 CDT 2000


----- Original Message -----
From: "rudy limeback" <r937 at interlog.com>
To: "evolt thelist" <thelist at lists.evolt.org>
Sent: Tuesday, July 04, 2000 7:02 PM
Subject: Re: [thelist] database eating brain...


> 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

<lightbulb>AHA!</lightbulb>

> 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

Gotcha. I had it reversed in my head. Unique first, and the uniqueness
happened to make it a convenient reference for related tables. The
multi-column primary key concept obviously bears some more investigation.

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

thanks.

> 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

You've nailed it. A grant can have more than one tool, hence naToolsUsed.
genGoalsTools is a FURTHER SUBSET of naToolsUsed. Because each grant may
have multiple goals, and each goal may refer to one or more of the
assessment tools.

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

'Zat make sense? I think I'VE got my original question figured out now. Just
bouncing it around has helped tremendously. If there are any other
suggestions or obvious points I've missed, I'd be happy to hear them.

Thanks!
Dave





More information about the thelist mailing list