Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind SQL LEFT JOIN Keyword?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___ Customers.CustomerName, Orders.OrderIDLeft 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
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).