When or why would you use a right outer join instead of left?

后端 未结 11 681
小蘑菇
小蘑菇 2020-11-27 05:47

Wikipedia states:

\"In practice, explicit right outer joins are rarely used, since they can always be replaced with left outer joins and provide no additional functi

11条回答
  •  猫巷女王i
    2020-11-27 06:18

    SELECT * FROM table1 [BLANK] OUTER JOIN table2 ON table1.col = table2.col
    

    Replace [BLANK] with:

    LEFT - if you want all records from table1 even if they don't have a col that matches table2's (also included are table2 records with matches)

    RIGHT - if you want all records from table2 even if they don't have a col that matches table1's (also included are table1 records with matches)

    FULL - if you want all records from table1 and from table2

    What is everyone talking about? They're the same? I don't think so.

提交回复
热议问题