Skip to content

[trees] - use INNER JOIN instead of LEFT OUTER JOIN

neutron requested to merge neutron/trees:left_outer_join_to_inner_join into master

An INNER JOIN returns in our case the same values compared to the LEFT OUTER JOIN, because there are no additional fields in our database. Though an "INNER JOIN" is what we want.

Difference between those two JOINS:

An inner join finds and returns matching data from tables, while an outer join finds and returns matching data and some dissimilar data from tables.

INNER JOIN:

An inner join focuses on the commonality between two tables. When using an inner join, there must be at least some matching data between two (or more) tables that are being compared. An inner join searches tables for matching or overlapping data. Upon finding it, the inner join combines and returns the information into one new table.

Outer Join

An outer join returns a set of records (or rows) that include what an inner join would return but also includes other rows for which no corresponding match is found in the other table.

Left Outer Join A left outer join will return all the data in Table 1 and all the shared data (so, the inner part of the Venn diagram example), but only corresponding data from Table 2, which is the right join.

See https://www.diffen.com/difference/Inner_Join_vs_Outer_Join for more information

Merge request reports