I'm just considering a project which would catalogue all the episodes of a TV show using SQL.

I'm trying to think through the normalisation, particularly because a number of people play a number of different roles, for instance say an actor might direct an episode, a person who's normally a writer has a cameo role in one show and so on.

If I were just doing an "actors_play_roles" kind of normalisation, based on the assumption that actor John Smith always plays the character Jake Jones, I could just have tables like this:

ACTORS: id | Name ---------------- 88 | John Smith ROLES: id | Name ---------------- 99 | Jake Jones ACTORS_ROLES: actor_id | role_id ------------------ 88 | 99
which says that Actor 88 played role 99.

But what if he plays Jake Jones in one episode, and then Mycroft Jones, Jake's Evil Twin, in another?

What if he plays both parts in one ep?

Do I just need one big table of "people in general"? And then separate table of directors_of_episodes and actors_in_episodes and so on?

That seems over-complex, though I guess it's still normalised.

Or do I want to somehow do a three-column table like:

STUFF_PEOPLE_DO episode person function 1 | 88 | 23

where 23 is "actor", so we know that in episode 1, person 88 was an actor? And put which part he played somewhere else?

Any suggestions gratefully received.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

In reply to Normalisation Question (OT but trust me, perl implementation) by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.