Insufficient information to answer a question


#1

Exercise 4 is asking me the following:

“The table newspaper contains information about the newspaper subscribers. Count the number of subscribers who get a print newspaper.”

But how am I supposed to do this if I don’t know what tables exist? I have no reference for what columns to interact with. I have no idea how many columns there are.

Part of me wants to say my browser may not be loading this exercise correctly, or there is something I am missing, but I have tried to load this exercise on multiple browsers and multiple machines. The problem persists!

Any help would be appreicated. Thank you!


#2

Insufficient information for a discuss topic. Where is the link to the exercise?


#3

Not exactly sure if this will work, but here is a direct copy/paste of the address I’m on.

https://www.codecademy.com/courses/learn-sql-multiple-tables/lessons/multiple-tables/exercises/inner-join-ii?action=lesson_resume&course_redirect=learn-sql

Thanks for your attention


#4

Here is how to view all the tables in complete form:

SELECT * FROM newspaper;

SELECT * FROM online;

SELECT * FROM months;

#5

But that is my question. I had no way to know that there was a newspaper table, or an online table, or a months table. I could gather that there must be at least one table called newspaper, but there was no mention of an “online” table or a “months” table in the question.

Here is an image of what I am seeing. Is there something I am missing?


#6

It will raise an error but this is how to see what tables are present in the namespace…

SELECT *;

.> Error: near line 1: no tables specified

but it will show the schema for all the tables present.

Database Schema
newspaper60 rows
id	INT
first_name	VARCHAR(256)
last_name	VARCHAR(256)
email	VARCHAR(256)
start_month	INT
end_month	INT
online65 rows
id	INT
first_name	VARCHAR(256)
last_name	VARCHAR(256)
email	VARCHAR(256)
start_month	INT
end_month	INT
months12 rows
month	INT

#7

Okay weird. I thought I had tried that and I wasn’t getting a result. I tried again in a different browser and now it is working…

Maybe it was just a glitch.

Thank you sir!


#8

The instructions do tell us which tables to query, newspaper and online. We just need to take it on faith that the tables exist, but we’ve seen above how to query the full tables.


#9

I don’t see mention of an “online” table in the instructions, but it does also raise another question: I am confused as to why this instruction requires a JOIN command at all. If it just wants the newspaper subscribers, and not the online ones, why am I joining the online user IDs with the newspaper user IDs? The logic doesn’t follow to me…

To me, the correct query would simply be:

SELECT COUNT(*)
FROM newspaper;


#10

The JOIN will help you find the intersection of the two tables. They will intersect on user_id.


#11

Right, but that would result in showing the subscribers with both online and printed newspapers correct? So if the exercise is designed to teach the student to use the JOIN statement, why does it ask for ONLY the newspaper subscribers? That would not require a JOIN statement that I can see…


#12

Take for instance this COUNT of the number of intersections…

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

50

Now replace COUNT(*) with just * and examine the results.

Here is a simple query:

SELECT newspaper.id, online.last_name
FROM newspaper JOIN online
ON newspaper.id = online.id;

This is not my forte so the question is little vague. Study the above and see if it helps align your thinking.


#13

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.