1

I don't understand the fundamental set-up of tables in SQLite.

Let's say I have three tables:

Studio Table
studioID studioName
-------- --------
1 Lucasfilm
2 Amblin Entertainment
3 Zoetrope Studios
Movie Table
movieID movieName studioID actorID
-------- -------- -------- --------
1 Star Wars 1 1
2 Indiana Jones 1 1
3 Back to the Future 2 3
4 Apocalypse Now 3 2
Actor Table
actorID lastName firstName
-------- -------- --------
1 Ford Harrison
2 Fishburne Laurence
3 Lloyd Christopher

This structure doesn't allow for the fact that Harrison Ford and Laurence Fishburne were both in Apocalypse Now. What would be a conventional way to represent Ford and Fishburne acting in the same movie using similar tables? Sorry for the newbie question.

asked Oct 14, 2013 at 20:14

2 Answers 2

1

What would be a conventional way to represent both being in the same movie using similar tables?

There is none.

You need another table: cast

cast table
---------
movieID
actorID

Example data:

movieID | actorID
 4 | 1
 4 | 2

And maybe there should even be another column in the cast table: roleName. The same actor could have multiple roles in one movie.

answered Oct 14, 2013 at 20:15
Sign up to request clarification or add additional context in comments.

Comments

0

Studio 1 : N Movies -> One table for Studios, one for movies and add a FK from studio in movies.

Movies N : M Actors -> One table for actors, and another that links Movies and actors.

answered Oct 14, 2013 at 20:17

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.