Member-only story

SQL Left Join

Hubert Dudek
3 min readJan 17, 2025

--

This course is part of the SQL Bootcamp series.

Access for free via friend’s link https://databrickster.medium.com/a045ce84b233?source=friends_link&sk=30f40037b5ecac19916b776fb9a8df6c

A LEFT JOIN returns all rows from the left (first) Table and any matching rows from the right (second) table. If there is no match, the left-side row still appears, but with NULL for the right-side columns.

Here is a classic Venn-style diagram showing a LEFT JOIN in the abstract (i.e., not tied to any specific tables yet):

  • Left Table: all rows appear in the result.
  • Right Table: rows only appear if they match the Left Table on the join condition.
  • Result: unmatched left rows appear with NULL for right-table columns.

Example with Countries and Cities

Below is a simplified scenario with Countries (left Table) and Cities (right Table).

    Countries:
(1, 'France')
(2, 'Italy')
(3, 'Poland')
Cities:
(1, 'Paris') with country_id=1
(2, 'Rome') with country_id=2
(3, 'Milano') with country_id=2
(4…

--

--

No responses yet