FAQ: Multiple Tables - Inner Joins

Community%20FAQs%20on%20Codecademy%20Exercises

This community-built FAQ covers the “Inner 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 Inner 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!

Um hello, So each time i ‘join’ 2 tables with or without an ON statement, after compilation, i get to find out that the 2 tables will literary get glued together(as in one before the other all at once) which doesn’t seem right to me.
Could i be wrong? I would :heart: a reply.

In this exercise, I was told to combine 2 tables.
There are 2 tables in total, one is “newspaper” one is “online” if when I combine them and I use the COUNT function and I get 50 people in total. Does that mean that there are 50 people that their subscription includes newspaper and articles online?
(This is my code):

SELECT COUNT(*) 
FROM newspaper 
JOIN online 
	ON newspaper.id = 
  online.id;
1 Like

Yes, it only joins the rows that have identical value in the id column, which means that the people in the result are the people that use online and printed subscription.

I also looked at all three tables and compared them to see this better, using this code:

SELECT *
FROM newspaper
JOIN online
ON newspaper.id= online.id
ORDER BY first_name
LIMIT 10;

SELECT *
FROM newspaper
ORDER BY first_name ASC
LIMIT 10;

SELECT *
FROM online
ORDER BY first_name ASC
LIMIT 10;

I ran the #3 task in this module and I keep getting this in red:

Did you remember to count all rows of online joined with newspaper?
not too sure what is going on.

I deleted it and copied the “hint” and reran and same results.
please let me know what to do…

the results are showing the results 50
so not too sure what I am missing to “next”

I figured it out I left a couple queries on and it seem to confuse it.

Hey Codeacademy team,

When you guys ask us to answer questions about tables, please give us the entire context of the table so we can reference it. It’s incredible frustrating to not even know what the table layouts are when being presented new data. GIVE US THE TABLE TO REFERENCE SOMEWHERE. Thanks!

try use the following it should work( next user/coming users)

select count(*) from newspaper;

select count(*) from online;

SELECT count (*)

FROM newspaper JOIN online

ON newspaper.id = online.id;