What makes a given table the left table?
Is it that the table is indicated in the "From" part of the query?
Or, is it the left table because it is on the left hand side of the = operator?
Are the following equivalent
SELECT * FROM left_table LEFT JOIN right_table ON left_table.right_id = right_table.id
and
SELECT * FROM left_table LEFT JOIN right_table on right_table.left_id = left_table.id
???
Thanks
The LEFT JOIN keyword returns all records from the left table (table1), and the matching records from the right table (table2).
The RIGHT JOIN keyword returns all records from the right table (table2), and the matching records from the left table (table1).
The main difference between the Left Join and Right Join lies in the inclusion of non-matched rows. Left outer join includes the unmatched rows from the table which is on the left of the join clause whereas a Right outer join includes the unmatched rows from the table which is on the right of the join clause.
The Left table is the first table in the select. Yes, your two examples are equivalent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With