What is the difference between INNER JOIN , OUTER JOIN , FULL OUTER JOIN ?
What is the difference between INNER JOIN , OUTER JOIN , FULL OUTER JOIN ?
A join combines rows from two tables on a condition. The join type decides what happens to rows without a match.
| Join | Result |
|---|---|
INNER JOIN |
Only rows with a match on both sides. |
LEFT [OUTER] JOIN |
All left rows; right columns are NULL when there is no match. |
RIGHT [OUTER] JOIN |
All right rows; left columns are NULL when there is no match. |
FULL [OUTER] JOIN |
All rows from both sides; NULL where unmatched. |
CROSS JOIN |
Every left row paired with every right row (cartesian product). |
OUTER is optional: LEFT JOIN and LEFT OUTER JOIN are the same thing.
-- customers(id, name): 1 Ann, 2 Bob, 3 Cy
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.