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

Dave Morriss dave.morriss at gmail.com
Wed May 15 02:46:28 PDT 2013


On 15/05/13 09:14, Keith Murray wrote:
> 
> 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.


I think we're saying the same thing.

For the record, I have attached my simplistic solution with the output
from the example query.

As an aside, I'm never sure if it's best to give a table a singular or
plural name - "episode" or "episodes". I guess it's one of those
questions that boil down to personal taste, but I'd be interested in
other views.

Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: db_answer.sql
Type: text/x-sql
Size: 1306 bytes
Desc: not available
URL: <http://hackerpublicradio.org/pipermail/hpr_hackerpublicradio.org/attachments/20130515/8bff798d/attachment.sql>
-------------- next part --------------
+---------+--------------+---------------+------------+------------+-------------------------+
| host_id | host_name    | email         | episode_id | ep_date    | title                   |
+---------+--------------+---------------+------------+------------+-------------------------+
|       1 | Joe Blow     | joe at blow.org  |          1 | 2013-05-15 | Database design         |
|       1 | Joe Blow     | joe at blow.org  |          2 | 2013-05-15 | MySQL versus PostgreSQL |
|       2 | Michael Dull | mike at dull.org |          2 | 2013-05-15 | MySQL versus PostgreSQL |
|       2 | Michael Dull | mike at dull.org |          3 | 2013-05-15 | What is Hacking?        |
+---------+--------------+---------------+------------+------------+-------------------------+


More information about the Hpr mailing list