Does the join order matter in SQL?

前端 未结 4 671
离开以前
离开以前 2020-11-22 15:02

Disregarding performance, will I get the same result from query A and B below? How about C and D?

-- A
select *
from   a left join b
           on 

        
4条回答
  •  Happy的楠姐
    2020-11-22 15:43

    If you try joining C on a field from B before joining B, i.e.:

    SELECT A.x, A.y, A.z FROM A 
       INNER JOIN C
           on B.x = C.x
       INNER JOIN b
           on A.x = B.x
    

    your query will fail, so in this case the order matters.

提交回复
热议问题