Isn't SQL A left join B, just A?
No, it's a join. If there are multiple matching rows from B then a row in A will show up multiple times.
Example:
Table A:
id name
-- -------
1 Alice
2 Malcolm
3 Kelly
Table B:
id_a preferred food
---- --------------
1 Pizza
2 Burger
2 Steak
2 Menestroni
Then "A left join B" will give you:
id name id_a preferred food
-- ------- ---- --------------
1 Alice 1 Pizza
2 Malcolm 2 Burger
2 Malcolm 2 Steak
2 Malcolm 2 Menestroni
3 Kelly null null
In short:
- All rows from A show up in the left join: even
3 Kelly
shows up. - Columns from B will show up with nulls when there's no matching rows in B: row
3 Kelly
hasnull
in the last two columns. - Rows in A may show up multiple times when they have multiple matches in B: row
2
shows up three times.
Your diagram isn't quite a Venn diagram.
The intersection of the two circles represents joined rows (according to your join condition) with data from both table A and table B.
The left crescent (labeled "A") represents rows in table A that do not have any corresponding rows in table B; the right crescent (labeled "B") represents rows in table B that do not have any corresponding rows in table A.
What the top left diagram is supposed to show is that a left join gives you data from both table A and B that can be joined up according to your join condition, plus all rows from table A that have no corresponding match in table B.