Is CROSS JOIN a synonym for INNER JOIN without ON clause?

前端 未结 2 506
再見小時候
再見小時候 2020-12-30 20:37

I am wondering whether CROSS JOIN can be safely replaced with INNER JOIN in any query when it is found.

Is an INNER JOIN witho

2条回答
  •  醉话见心
    2020-12-30 21:06

    A raw cross join is one that has no where clause meaning that one record is produced for every combination of the left and right tables being joined with nulls inserted where there is no left or right side data.

    If you add a where clause to a cross join this makes it equivalent to an inner join as the where clause does the same thing as the ON in the inner join.

    However, inner joins are generally nicer to use as this separates the ON condition away from the rest of your where clauses making it easier to understand.

提交回复
热议问题