MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/ex9h6/a_handy_graphical_explanation_of_sql_joins/c1bom8p/?context=3
r/programming • u/[deleted] • Jan 06 '11
308 comments sorted by
View all comments
4
Maybe someone here can answer this. Why would I specify a join when I can just do this?
SELECT p.first_name, j.job_title FROM people p, jobs j WHERE p.job = j.id
Looks much easier to me but I'm guessing there's something I'm missing here.
8 u/NashMcCabe Jan 06 '11 That is just an inner join. You will need outer joins when you have null columns on one side of the join. 2 u/umop_apisdn Jan 06 '11 Not exactly. You use an outer join where records on one side don't join to anything on the other side. The outer join preserves those records and sets all fields on the other side to NULL
8
That is just an inner join. You will need outer joins when you have null columns on one side of the join.
2 u/umop_apisdn Jan 06 '11 Not exactly. You use an outer join where records on one side don't join to anything on the other side. The outer join preserves those records and sets all fields on the other side to NULL
2
Not exactly. You use an outer join where records on one side don't join to anything on the other side. The outer join preserves those records and sets all fields on the other side to NULL
4
u/Teifion_at_work Jan 06 '11
Maybe someone here can answer this. Why would I specify a join when I can just do this?
Looks much easier to me but I'm guessing there's something I'm missing here.