Code Challenge 3 || SQL
Code Challenge 3 || SQL
For this challenge, you’ll use the following tables:
Which users?aren’t?premium users?
Use a?LEFT JOIN?to combine?users?and?premium_users?and select?id?from?users.
The column?id?in?users?should match the column?user_id?in?premium_users.
Use a?WHERE?clause to limit the results to users where?premium_users.user_id IS NULL. This will remove premium users and leave you with only free users.
The solution :
SELECT users.id
FROM users
LEFT JOIN premium_users
ON premium_users.user_id = users.id
WHERE premium_users.user_id IS NULL;