bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL LEFT JOIN

Concept visual

SQL LEFT JOIN

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

Start at both ends

Sql Left Join

The LEFT JOIN returns all rows from the left table (table1), and only the matched rows from the right table (table2). If there is no match in the right table, the result for the columns from the right table will be NULL.

The LEFT JOIN

and

Left Outer Join

Formula

keywords are equal - the OUTER

keyword is optional.

LEFT JOIN Syntax

Select

column_name(s)

From

table1

Left Join

table2 ON table1.column_name = table2.column_name

;

Demo Database

Below is a selection from the "Customers" table:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

Alfreds Futterkiste

Maria Anders

Obere Str. 57

Berlin

12209

Germany

Ana Trujillo Emparedados y helados

Ana Trujillo

Avda. de la Constitución 2222 México D.F. 05021

Mexico

Antonio Moreno Taquería

Antonio Moreno

Mataderos 2312

México D.F. 05023

Previous

SQL INNER JOIN

Next

SQL RIGHT JOIN