LEFT JOIN vs. LEFT OUTER JOIN in SQL Server

后端 未结 12 1881
失恋的感觉
失恋的感觉 2020-11-21 13:25

What is the difference between LEFT JOIN and LEFT OUTER JOIN?

相关标签:
12条回答
  • 2020-11-21 13:56

    To answer your question

    In Sql Server joins syntax OUTER is optional

    It is mentioned in msdn article : https://msdn.microsoft.com/en-us/library/ms177634(v=sql.130).aspx

    So following list shows join equivalent syntaxes with and without OUTER

    LEFT OUTER JOIN => LEFT JOIN
    RIGHT OUTER JOIN => RIGHT JOIN
    FULL OUTER JOIN => FULL JOIN
    

    Other equivalent syntaxes

    INNER JOIN => JOIN
    CROSS JOIN => ,
    

    Strongly Recommend Dotnet Mob Artice : Joins in Sql Server

    0 讨论(0)
  • 2020-11-21 13:57

    What is the difference between left join and left outer join?

    Nothing. LEFT JOIN and LEFT OUTER JOIN are equivalent.

    0 讨论(0)
  • 2020-11-21 14:00

    There are only 3 joins:

    • A) Cross Join = Cartesian (E.g: Table A, Table B)
    • B) Inner Join = JOIN (E.g: Table A Join/Inner Join Table B)
    • C) Outer join:

         There are three type of outer join
         1)  Left Outer Join     = Left Join
         2)  Right Outer Join    = Right Join
         3)  Full Outer Join     = Full Join    
      

    Hope it'd help.

    0 讨论(0)
  • 2020-11-21 14:03

    Syntactic sugar, makes it more obvious to the casual reader that the join isn't an inner one.

    0 讨论(0)
  • 2020-11-21 14:04

    Left Join and Left Outer Join are one and the same. The former is the shorthand for the latter. The same can be said about the Right Join and Right Outer Join relationship. The demonstration will illustrate the equality. Working examples of each query have been provided via SQL Fiddle. This tool will allow for hands on manipulation of the query.

    Given

    enter image description here

    Left Join and Left Outer Join

    enter image description here

    Results

    enter image description here


    Right Join and Right Outer Join

    enter image description here

    Results

    enter image description here

    0 讨论(0)
  • 2020-11-21 14:05

    There are mainly three types of JOIN

    1. Inner: fetches data, that are present in both tables
      • Only JOIN means INNER JOIN
    2. Outer: are of three types

      • LEFT OUTER - - fetches data present only in left table & matching condition
      • RIGHT OUTER - - fetches data present only in right table & matching condition
      • FULL OUTER - - fetches data present any or both table
      • (LEFT or RIGHT or FULL) OUTER JOIN can be written w/o writing "OUTER"
    3. Cross Join: joins everything to everything

    0 讨论(0)
提交回复
热议问题