bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL LEFT JOIN Keyword

Concept visual

SQL LEFT JOIN Keyword

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

LEFT JOIN Keyword

Previous

❮ SQL Keywords

Next

Left Join

The LEFT JOIN

command returns all rows from the left table, and the matching rows from the right table. The result is NULL from the right side, if there is no match. The following SQL will select all customers, and any orders they might have:

Example

SELECT Customers.CustomerName, Orders.OrderID

FROM Customers

LEFT JOIN Orders

Formula

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 are no matches in the right table (Orders).

Previous

❮ SQL Keywords

Next

Previous

SQL JOIN Keyword

Next

SQL LIKE Keyword