Multiple tables quiz 5 q2

MULTIPLE TABLES QUIZ 5 Q2.

In order to find which users do not subscribe to the online edition, we need to add a WHERE clause. Create a new query that adds the following WHERE clause:

WHERE online.id IS NULL

This will select rows where there was no corresponding row from the online table.

Can everyone give me the answer?

Simply write the statement after the the JOIN… ON part.

It would look like this:

Code

SELECT *
FROM newspaper
LEFT JOIN online
ON newspaper.id = online.id
WHERE online.id IS NULL;

Thanks.
But I tried, It didn’t work.
As the picture shown:

Uhm, maybe it’s a bug. At this point you might want to reset the exercise, and try all over again. I posted the solution below if that doesn’t help.

Solution

– First query
SELECT *
FROM newspaper
LEFT JOIN online
ON newspaper.id = online.id;

– Second query
SELECT *
FROM newspaper
LEFT JOIN online
ON newspaper.id = online.id
WHERE online.id IS NULL;

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