Example
Table: Customers
CustomerID | CustomerName |
---|---|
1 | Alice |
2 | Bob |
3 | Carol |
Table: Orders
OrderID | CustomerID | OrderDate |
---|---|---|
101 | 1 | 2024-01-01 |
102 | 3 | 2024-02-01 |
103 | 4 | 2024-03-01 |
LEFT OUTER JOIN Example:
1 2 3 4 5 |
SELECT Customers.CustomerID, Customers.CustomerName, Orders.OrderID, Orders.OrderDate FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID; |
Result:
CustomerID | CustomerName | OrderID | OrderDate |
---|---|---|---|
1 | Alice | 101 | 2024-01-01 |
2 | Bob | NULL | NULL |
3 | Carol | 102 | 2024-02-01 |