> -----Original Message-----
> From: Ben Holness [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 28, 2002 7:43 AM

....

> Have I understood the two table concept correctly?
> How does the third table fit in?
>
> I guess that if two (or more) of the entries overlap, I could make things
> even better by having a multi-value field for the list ID in the second
> table, allowing:
>
> b&c,entry65
>
> if entry65 was common to lists b and c ... Is there a limit to
> the number of
> values in a multi-value field? (Does MySQL offer multivalue fields?) and
> would this be appropriate?

I'm assuming that by distribution list, you mean you're storing something
like e-mail addresses?  And now I have to take back the notion that storing
the lists in a file would be efficient at all.  If you're going to
manipulate individual items (name, address, whatever) in the list, by all
means put them in the database as rows.

I think that only two tables would be needed -- one that I'd call "owner,"
with the data that relates to the owners of lists, with the list ID as the
primary key.  The second would be for entries (subscriber?), with the list
ID as a foreign key (not that MySQL knows about foreign keys).  Your overlap
is handled with additional rows.  For example, if [EMAIL PROTECTED] is in lists a
and b, then there are two records for joe -- one that contains
"a,[EMAIL PROTECTED]" and anther with "b,[EMAIL PROTECTED]".  A third table would just
complicate things.  The primary key would be the list ID and the address, in
this example, which would ensure that you wouldn't have duplicate entries.
Then a query such as "select * from subscriber where list_id='a'" would find
everybody subscribed to list a.  "select * from subscriber where
subscriber='[EMAIL PROTECTED]'" would find all the lists to which joe is
subscribed.

This is pretty familiar to me because I'm analyzing the behavior of people
in on-line discussions, so I'm gathering such data.

Nick



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