MySQL SQLLesson 30Free preview
MySQL LEFT JOIN
This lesson is part of MySQL · All levels
Summary
LEFT JOIN (or LEFT OUTER JOIN) displays the entire row from the left table, then pairs it with the right table column when appropriate. If there is no pair, the right table column is filled with NULL. This pattern is very useful for finding data that doesn't have a related record, like customers who never ordered.
Key points
- LEFT JOIN guarantees that all left table rows are included
- The right-hand table column becomes NULL when there is no matching pair
- The table on the left is the table written right after FROM before the word JOIN
- Adding WHERE to the right-hand column of the table can change the effect to be like INNER JOIN
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.