Does the result change if we JOIN tables in a different order?

Question

In the context of this exercise, does the result change if we JOIN tables in a different order?

Answer

No, when applying JOIN, also known as INNER JOIN, the data is joined on wherever there are matching values on a certain column specified by the ON clause, and regardless of the table order in the JOIN, the result should be the same. So whether you do
plays JOIN songs
or
songs JOIN plays
the results would be the same.

The only difference would be the order that the columns and rows appear in the result set, which will follow the order of the first, or left, table, but which can be easily modified so that there is no difference, such as by using an ORDER BY clause.

8 Likes