Joins: Commutativity

When an operation is commutative, the ordering of elements does not matter.

Addition and multiplication are both commutative. You can change the order of the elements. The result is always the same.

Addition

Multiplication

SQL

Inner Join

A INNER JOIN B = B INNER JOIN A

Left/Right Join

Left/Right joins are not commutative.

That is

A LEFT JOIN B <> B LEFT JOIN A

But:

A LEFT JOIN B = B RIGHT JOIN A

References

http://blog.ylett.com/2011/09/non-associativity-of-sql-table-joins.html http://www.sql-tutorial.ru/en/book_explicit_join_operations/page4.html