1.

What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN?

Answer»
  1. INNER JOIN: Returns rows when there is a MATCH in both joined tables
  2. LEFT JOIN: Returns all rows from the left table, even if there are no matches in the right table.
  3. RIGHT JOIN: Returns all rows from the right table, even if there are no matches in the left table.
  4. FULL JOIN: It combines the results of both left and right outer joins.

For INNER joins,  the order doesn't matter. The queries will return the same results, as long as we change your selects from SELECT * to SELECT a.*, b.*, c.*.

For (LEFT, RIGHT or FULL) OUTER joins, YES, the order matters.

First, outer joins are not COMMUTATIVE, so a LEFT JOIN b is not the same as b LEFT JOIN a



Discussion

No Comment Found