Code Challenge 3 || SQL

Code Challenge 3 || SQL

Code Challenge 3 || SQL

For this challenge, you’ll use the following tables:

No alt text provided for this image
No alt text provided for this image

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;
        

要查看或添加评论,请登录

Ahmed Khaleel的更多文章

社区洞察

其他会员也浏览了