SQL JOIN Helper
Visual reference for INNER / LEFT / RIGHT / FULL / CROSS / SELF joins with live-simulated results.
LEFT (OUTER) JOIN
All rows from the left; right-side columns are NULL when there's no match.
Example query
SELECT u.id, u.name, o.id, o.total FROM users u LEFT JOIN orders o ON o.user_id = u.id;
users
| id | name |
|---|---|
| 1 | Alice |
| 2 | Bob |
| 3 | Carol |
orders
| id | user_id | total |
|---|---|---|
| 100 | 1 | 42 |
| 101 | 1 | 7 |
| 102 | 2 | 15 |
| 103 | 9 | 99 |
Result (4 rows)
| u.id | u.name | o.id | o.total |
|---|---|---|---|
| 1 | Alice | 100 | 42 |
| 1 | Alice | 101 | 7 |
| 2 | Bob | 102 | 15 |
| 3 | Carol | NULL | NULL |
Mental model
Every JOIN starts as a Cartesian product (every left row × every right row) and is then filtered by the ON condition. The flavor (INNER, LEFT, etc.) controls what happens to rows that don't match.
Pick by question
- “Only matching rows” → INNER
- “All on the left plus matches” → LEFT
- “All on the right plus matches” → RIGHT
- “Everything from both sides” → FULL OUTER
- “Every pairing” → CROSS
You might also like
- Escape / UnescapeEscape or unescape strings for JSON, JavaScript, HTML attribute, XML, and SQL contexts.
- SQL CREATE TABLE GeneratorInfer column types from sample data and emit CREATE TABLE for PostgreSQL, MySQL, SQLite, or SQL Server.
- SQL DiffCompare two SQL queries or schemas after canonical formatting — ignore whitespace and casing noise.
- SQL Escape / UnescapeSafely quote string literals for ANSI, MySQL, or PostgreSQL — and reverse it.