r/webdev • • Mar 22 '19

SQL joins

/img/xd0kgoexwon21.jpg
2.7k Upvotes

118 comments sorted by

View all comments

Show parent comment

3

u/sumguy720 Mar 23 '19

select * from reddit_users outer join reddit_posts using (reddit_username)

would return a list of all reddit users with no posts (with nulls for their post data) and all reddit posts that somehow don't correspond to a user (with nulls for their user data). The final result would be a bunch of rows with blank data on the left, and a bunch of rows with blank data on the right.

Handy if you need to remove the overlap of two lists of items.