Jump to content

Recommended Posts

I have 2 tables:

 

1 - title (the columns are: titleID, title)

2 - talent (the columns are: talentID, first_name, last_name)

 

Titles in the first table are film titles, and entries in the second tables are actors. There can therefore be multiple actors in one film. How do I show this?

 

I know I need a link table or some sort  so that if for example;

Indiana Jones = titleID of '1'

Harrison Ford = talentID of '1'

Steven Spielberg = talendID of '2'

 

The link table would show two columns:

 

col1 - titleID

col2 - talentID

 

The link table would then be:

 

titleID    talentID

 

1                1

1                2

 

I cannot figure out even after hours of trying how to select all talentID in the link table that have a titleID of 1. please help!

 

 

Link to comment
https://forums.phpfreaks.com/topic/194299-query-help-needed-desperately/
Share on other sites

A simple join would end up with a many-to-many relationship.  Each actor will be in many films but each film will have many actors.

 

You need an intervening table to record who was in what.  Film -> actedIn <- talent.

 

Can't think of a good name for the new table for some reason!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.