I have to develop a web application for movies. For now, in my database, I have a table for the relations between figures and movies and another for the relations between actors (wich are also figures) and movies. The last one also contains information about the character.
My question in not about the normalization at all, I would like to know if it's more efficient in term of speed to do two queries for each tables or to merge them to a single one with NULL values for character in some tuples and do a single query ?
EDIT:
The two queries for now (figure side, to get his acting and career):
$query1 = '
SELECT RelationFigureCardType.department, RelationFigureCardType.job, Movie.card_type_id, Movie.id, Movie.original_name, Movie.release_date, Movie.cover, Movie.cover_ext
FROM relation_figure_cards AS RelationFigureCard
RIGHT JOIN relation_figure_card_types AS RelationFigureCardType ON
(RelationFigureCard.relation_figure_card_type_id = RelationFigureCardType.id)
RIGHT JOIN cards AS Movie ON
(RelationFigureCard.card_id = Movie.id)
WHERE
RelationFigureCard.figure_card_id = '.$figureId.'
AND RelationFigureCard.last_card_version = 1
ORDER BY Movie.card_type_id, RelationFigureCardType.priority, Movie.release_date
;
';
$query2 = '
SELECT RelationActorCard.is_main, RelationActorCard.is_guest, Movie.card_type_id, Movie.id, Movie.original_name, Movie.release_date, Movie.cover, Movie.cover_ext, Character.id, Character.original_name, Character.cover, Character.cover_ext
FROM relation_actor_cards AS RelationActorCard
RIGHT JOIN cards AS `Character` ON
(RelationActorCard.character_card_id = Character.id)
RIGHT JOIN cards AS Movie ON
(RelationActorCard.card_id = Movie.id)
WHERE
RelationActorCard.figure_card_id = '.$figureId.'
AND RelationActorCard.last_card_version = 1
ORDER BY Movie.card_type_id, Movie.release_date
;
';