Question: How do you know what to information to pull FROM and what table to JOIN to??
My Code :
left join users
on users_id = premium_users.user_id
where premium_users.user_id is null ;
LEFT JOIN premium_users
ON users.id = premium_users.user_id
WHERE premium_users.user_id IS NULL;
Hello @board2501067444 ,
Are you asking about which table to pull from first?
A LEFT JOIN will return all to records from the FIRST table and any matching records from the SECOND table.
YOUR Code: All the records from
PREMIUM_USERS table will be listed and any matching records from
CORRECT code: All the records from
USERS table will be listed and any matching records from
It’s important to understand the data in the tables and what information you are trying to retrieve. Depending on your data, you may get different results.
Left Join Explained
If this is a question from a lesson, please include the link. It will give us some context to help you better.