Difference between FULL JOIN & INNER JOIN

前端 未结 8 1084
我在风中等你
我在风中等你 2020-11-30 17:33

What is the difference between a FULL JOIN and an INNER JOIN?

When I do a FULL JOIN, I get 832 records and with an INNER

8条回答
  •  无人及你
    2020-11-30 17:54

    Consider Table A and Table B

    Table A - (Key, Name)

    1, Data1 2, Data2 4, Data4 5, Data5

    Table B - (Key, FKey, Name)

    1, 1, DataA 2, 2, DataB 3, NULL, DataC 4, 4, DataD

    An inner join would return

    • 1, Data1, 1, 1, DataA
    • 2, Data2, 2, 2, DataB
    • 4, Data3, 4, 4, DataD

    whilst a full outer join would return

    • 1, Data1, 1, 1, DataA
    • 2, Data2, 2, 2, DataB
    • NULL, NULL, 3, NULL, DataC
    • 4, Data4, 4, 4, DataD
    • 5, Data5, NULL, NULL, NULL

提交回复
热议问题