LEFT JOIN

In this lesson, we will discuss the LEFT JOIN keyword.

We'll cover the following

LEFT JOIN

The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side if there is no match.

Syntax

SELECT table1.column1, table2.column2...

FROM table1

LEFT JOIN table2

ON table1.common_field = table2.common_field;

Note: In some databases, LEFT JOIN is called LEFT OUTER JOIN.

Example

We want to select all customers and any orders they might have placed:

Get hands-on with 1400+ tech skills courses.