0

I have a collection of data like so

Programme title |  Episode  |  Subtitle  |  Performers  |  Description

Initially I normalised this into two table like so

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

I'm thinking I'd like to represent the performers in another table though, but not sure how to represent it. From what I can tell the following relationships exist

  • One to Many: A programme can have many performers
  • One to Many: A performer could feature in many programmes

I'm not sure how I would represent this?

EDIT Ah I see so I'd actually have tables like this for example?

PERFORMER

performerid  |  performer

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

PROG_PERFORMER

progid  |  performerid
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
PDStat
  • 5,513
  • 10
  • 51
  • 86
  • The PROG_PERFORMER table should be EPISODE_PERFORMER. If the performers change per episode, and you change the PROG_PERFORMER table, that will change performers for all episodes – TimC Jan 21 '11 at 09:32

3 Answers3

2

Also, performers can change between episodes

TimC
  • 1,051
  • 9
  • 16
1

It's many-to-many. One performer can be in multiple programs, and one program can have multiple performers.

There's plenty of information on the net (and in textbooks) about setting up many-to-may relationships. One such resource is here:

http://www.tekstenuitleg.net/en/articles/software/database-design-tutorial/many-to-many.html

Really, though it should be

  • A Program has a one-many relationship with episodes
  • An episode has a many-many relationship with performers.

This is enough to create a query that will list all performer/show/episode relationships.

David
  • 72,686
  • 18
  • 132
  • 173
1

beside performer table you have to create a relation table

performer table

performerid | name | ...

relation table

performerid | progid
lweller
  • 11,077
  • 3
  • 34
  • 38