SQLancer
← Back to All Blogs
Queries August 12, 2026 5 min read

SQL Joins Explained Visually (With Interactive Examples)

Written by Alex Rivers

Joins are the bread and butter of SQL, allowing you to combine fields from multiple tables using logical relationships. Let's break down the core join types visually.

1. INNER JOIN (The Overlap)

An INNER JOIN returns rows only when there is a match in both tables. If a record exists in table A but has no matching ID in table B, it is completely excluded from the query results.

-- Fetching matching employees and departments
SELECT employees.first_name, departments.department_name
FROM employees
INNER JOIN departments 
ON employees.department_id = departments.department_id;

2. LEFT JOIN (The Anchor)

A LEFT JOIN (or LEFT OUTER JOIN) returns all records from the left table, plus the matching records from the right table. If there's no match on the right, the database fills those columns with NULL values.

3. FULL OUTER JOIN (The Whole Picture)

A FULL JOIN returns all records when there is a match in either left or right table records. Unmatched fields are filled with NULLs in both directions.

Practice SQL

Master Relational Database Systems

Ready to practice database querying? Execute queries directly in our Wasm sandbox.

Practice →