[Hpr] How to link multiple hosts in a mysql db

Keith Murray kdmurray at kdmurray.com
Wed May 15 01:14:28 PDT 2013


Normally for something like this I'd have a separate table to link hosts and shows where you could create multiple entries for each show.

K.

On 2013-05-15, at 1:05, Dave Morriss <dave.morriss at gmail.com> wrote:

> On 15/05/13 08:49, Ken Fallon wrote:
>> Those with DB experience might be able to help me out here.
>> 
>> Per episode we need to list multiple hosts to a single show. Currently
>> there is only one "host_id" linking to a hosts table that matches to
>> "hosts.id". The hosts table has stuff like id, name, email etc.
>> 
>> What is the best/standard way to link the episode to multiple
>> contributors (hosts) in the host table ?
>> 
>> episode X has host a b and c.
>> 
>> Do I then have a field "contributors" with "a,b,c" in there ?
> 
> Isn't this a many-to-many relationship? An episode can have multiple
> contributors, and a contributor can have many episodes.
> 
> The article at
> http://stackoverflow.com/questions/9789736/how-to-implement-a-many-to-many-relationship-in-postgresql
> explains it for PostgreSQL, but it's a generic solution. You need a
> joining table to express the man-to-many stuff.
> 
> [I once read a book on database design so I'm not an expert!]
> 
> Dave
> 
> 
> 
> _______________________________________________
> Hpr mailing list
> Hpr at hackerpublicradio.org
> http://hackerpublicradio.org/mailman/listinfo/hpr_hackerpublicradio.org




More information about the Hpr mailing list