Returns all records from the left table, and matched records from the right table. If no match, returns NULLs.
Query -
SELECT Customers.name, Orders.order_amount
FROM Customers
LEFT JOIN Orders
ON Customers.customer_id = Orders.customer_id;
Result and observation -
name | order_amount |
---|---|
Alice | 250 |
Alice | 125 |
Bob | 300 |
Charlie | NULL |
Charlie had no orders, but still appears.