Question
Can you use left joins to match character names with the actors that play them? Select the columns: character . name , actor . name
Can you use left joins to match character names with the actors that play them? Select the columns: character.name, actor.name
In the previous exercise, we used joins to match up TV character names with their actors. When you use INNER JOIN, that is called an "inner join" because it only returns rows where there is data for both the character name and the actor.
However, perhaps you want to get all of the character names, even if there isn't corresponding data for the name of the actor. A LEFT JOIN returns all of the data from the first (or "left") table, and if there isn't corresponding data for the second table, it returns NULL for those columns.
Using left joins between character names and TV shows would look like this:
SELECT character.name, tv_show.name
FROM character
LEFT JOIN character_tv_show
ON character.id = character_tv_show.character_id
LEFT JOIN tv_show
ON character_tv_show.tv_show_id = tv_show.id;
Note: Other variants of SQL have RIGHT JOIN and OUTER JOIN, but those features are not present in SQLite.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Yes you can use LEFT JOINs to match character names with t...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started