I’m not a db expert and this is for sure a newbie question.
I’ve a SQLite db containing data about movies.
The main table (movies) contains:
- movie_id (autoincrement, primary);
- title;
- year;
- other fields;
Then I have the actors table:
- actor_id (autoincrement);
- name;
- surname;
Then I have the cast table:
- movie_id (related to movies table);
- actor_id (related to the actors table, eg. Robin Williams);
- character_name (the name of the character, eg. “Mrs Doubtfire”);
In a single query I should retrieve all the characters of a given movie (at the application level I’ve the id of the current movie to start), name and surname of the actor and a list of the movies (!= this current movie) where the actor had a role:
Character_name | Actor | Other movies where we've seen this actor
Mrs Doubtfire | Robin Williams | Mork & Mindy, Dead Poets Society, ...
Other name | Other actor | Related movies,...
Is this possible? How?
Try: