I am trying to create a query for a library database that meets the following requirements: the number of books written by authors of Spanish nationality who they lived in the second half of the 20th century by editorial, together with the name of the editorial. All publishers must appear, even if they did not publish any author of Spanish nationality.
The problem is that I have to do three joins to get the requested data and in doing so I am having problems to stay with all the publishers even if they have not published for any Spanish author, I have tried to obtain it with a right join but it does not seem function... This is what I have, everything works except that I do not return publishers with null authors:
select count(titulo), nombre, editorial
from libro join autor
on libro.autor = autor.codigo
right join edicion
on edicion.libro = libro.codigo
where nacionalidad = 'Española' and fecha_nacimiento > '1950-01-01'
group by nombre, editorial
What can be failing?