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

Dave Morriss dave.morriss at gmail.com
Wed May 15 01:05:31 PDT 2013


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






More information about the Hpr mailing list