4 ms·
The fact that I don't use "on" is just syntax, it doesn't change the query. The following query is equivalent. select tbl_1.A from tbl_1 left joi
by ryanmonroe 8y ago
The fact that I don't use "on" is just syntax, it doesn't change the query. The following query is equivalent.
select tbl_1.A
from tbl_1
left join tbl_2
on tbl_1.A = tbl_2.A
I don't think this is a special complex example. It's about as simple as you can get.
- 0xfffafaCrash 8y agoThis was incorrect:”The Venn diagram depicts a left-join as a set difference, which it clearly is not.” It is in fact a set difference and the sets in question are values for the column being ONed on in each table (as I explained in the top level comment) My reply was with respect to these being cross joins with filters. That’s just one way of thinking about a JOIN that actually adds notational complexity (and does not actually represent how your database would be doing the join because it would be unnecessarily expensive computationally). Thinking of it in terms of a set difference of the values in thr ON column is arguably the better way of thinking of it if you are interested in how such a join should be implemented. Alternatively you can interpret the venn diagrams as just the filtration if you prefer interpreting as a cross join with filters.
- ryanmonroe 8y agof you have one set with 5 elements and another with 10, the set difference cannot have 13 elements. ------- In anticipation of some possible technical replies, let me be more explicit: It isn't a set difference, no matter how you view it. Viewpoint 1: The original lists of objects are not actually sets because the elements are not distinct. From this viewpoint, it isn't a set difference because they aren't even sets to begin with. Viewpoint 2: There is an implicit "row number" feature of each object so in that sense the objects are distinct and do form sets. From this viewpoint, it still isn't a set difference. If you have one set with 5 elements and another with 10, the set difference cannot have 13 elements.