English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The LEFT JOIN command returns all rows from the left table, as well as the matching rows from the right table. If there is no match, the result from the right side is NULL.
The following SQL will select all customers and any orders they may have:
SELECT Customers.CustomerName, Orders.OrderID FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID ORDER BY Customers.CustomerName;
Note:The LEFT JOIN keyword returns all records from the left table (Customers), even if there is no match in the right table (Orders).