Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Databases questions