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 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;
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;
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!
It could be me but the instructions are a bit confusing. The first lesson does not specify whether or not we are dealing with multiples tables nor do we have any reference. Please add the table or provide the schema as reference. Thank you.
I’m a little confused on this lesson because it in checkpoint 3 it reads, “Don’t remove your previous queries.
Join newspaper table and online table on their id columns (the unique ID of the subscriber).
How many rows are in this table?” and the goes on to provide a hint with code that has not been introduced to us as beginners nor does it state anywhere in the checkpoint that these are the steps you need to take. It reads, "Suppose we do:
SELECT *
FROM newspaper
LIMIT 10;
SELECT *
FROM online
LIMIT 10;
Where in the previous lessons does it say these are the steps needed to follow. When am I supposed to do this first, before joining tables? Is this always how I should code it? Is it only in certain cases? What kind of cases? Is there a definitive, concrete, set-in-stone way of doing coding it? I understand the syntax, but sometimes the syntax changes depending on the query. So, how do I know when I need to use this method?
I have a similar doubt. I expected the two tables to be glued together like that, but I expected only one of the ‘id’ columns to remain, since these are the columns used in the ON statement, and from the animation in the lesson it would seem that only one of those columns should remain after joining them.