Get Name from characters that died on Episode3 with its killer

You can join the characters table twice:

select c.name, k.name as killer
from films f
inner join deaths d on f.id = d.id_film
inner join characters c on c.id = d.id_character 
inner join characters k on k.id = d.id_killer
where f.episode = 'Episode III'

Notes:

  • Use standard joins! Implicit joins (with commas in the from clause) are legacy syntax from (literaly) decades ago, that should not be used in new code

  • Use single quotes for literal strings; in standard SQL, double quotes stand for identifiers (although MySQL makes things differently)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top