Difference between JOIN and INNER JOIN

前端 未结 6 1910
离开以前
离开以前 2020-11-22 06:31

Both these joins will give me the same results:

SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK

vs

SELECT *         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 07:00

    Similarly with OUTER JOINs, the word "OUTER" is optional. It's the LEFT or RIGHT keyword that makes the JOIN an "OUTER" JOIN.

    However for some reason I always use "OUTER" as in LEFT OUTER JOIN and never LEFT JOIN, but I never use INNER JOIN, but rather I just use "JOIN":

    SELECT ColA, ColB, ...
    FROM MyTable AS T1
         JOIN MyOtherTable AS T2
             ON T2.ID = T1.ID
         LEFT OUTER JOIN MyOptionalTable AS T3
             ON T3.ID = T1.ID
    

提交回复
热议问题