I’m unsure about the answer of question 6 if it’s correct or needs a correction:
Q6: Over time, posts may be removed and users might delete their accounts.
We only want to see existing posts where the users are still active, so use an INNER JOIN
to write a query to get these posts. Have the posts
table as the left table.
-- STEP 6:
SELECT *
FROM posts
INNER JOIN users
ON posts.user_id = users.id;
PLEASE CHECK THE ANSWER, If answer is correct but I don’t understand how it satisfies the asking query?
What’s the schema of the tables? The correctness depends on the logic of the tables in a sense. If existence of an id in users implies activeness, then an inner join alone is enough. If however, there’s an IsActive
in users, there should be a where clause added to filter for that.
(This is all remembering that an INNER JOIN is equivalent to set intersection in set theory (i.e., only the elements shared in common between two sets).
Here is the schema for the review for your kind observation for review.
Yea so I’m guessing by virtue of being in the users table it means the account is active.
1 Like
toastedpitabread you can try with strftime function

OP is asking about whether the accounts are still active. strftime formats datetime to strings, so maybe I’m missing what you’re saying.
1 Like