It seems like the safest way to think of an Inner Join is to think of it as a Cross Join and then sa

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-04-25T11:25:24Z Indexed on 2010/04/25 11:33 UTC
Read the original article Hit count: 287

Filed under:
|
|

It seems like the safest way to think of an Inner Join is to think of it as a Cross Join and then satisfying some condition(s)?

Because the equi-join can be obvious, but the non-equi-join can be a bit confusing.

But if we always use the Cross Join, and then filter out the ones satisfying the condition, then we get the resulting table.

In other words, we can always analyze it by using the first record on the left table, and then go through every single records on the right, and then repeat that for 2nd record on the left, and for the 3rd, 4th, ... etc.

So in our mind, we can analyze it using this way, and it is like O(n^2), although what happens in the DBMS maybe that it is a lot faster (when an index is present).

Is there another good way to think of it besides this method?

© Stack Overflow or respective owner

Related posts about join

Related posts about inner-join