FAQ: Multiple Tables - Left Joins


#1

This community-built FAQ covers the “Left Joins” exercise from the lesson “Multiple Tables”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Data Science

Learn SQL

FAQs on the exercise Left Joins

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

When the task asked us to find the number of users who subscribed to the print newspaper but not to the online, can we just do a SELECT * FROM newspaper; instead of taking a left join of newspaper and online, and then eliminating all those rows in online that have a valid id?


#3

Can anyone explain the logic behind number 2 of this problem?

It says to join newspaper.id = online.id and then where online.id is NULL;

Wouldn’t that mean that the newspaper id is also null?


#4

If you just write SELECT * FROM newspaper; , you actually do a search only to the newspaper table. However, the task is asking you to do a search at the second table (online) as well in order to find those that are not line subscribers. This simultaneous query at the 2 tables can be done here only by using LEFT JOIN. Otherwise, your query is limited only to the newspaper table.