SQL Join Visualizer
Type two small tables and see exactly which rows INNER, LEFT, RIGHT, FULL and CROSS joins return.
How it works
Type two small tables as comma separated lines. The first line is the column names. Pick the columns to match and the join type. The tool shows exactly which rows come out, with NULL where there is no match.
The formula
INNER: only rows with a match on both sides LEFT: all left rows, NULL for the right if no match RIGHT: all right rows, NULL for the left if no match FULL: all rows from both CROSS: every left row with every right row (n x m)
Worked example
Users 1, 2, 3 and courses for users 1, 1 and 4. INNER JOIN gives 2 rows (user 1 twice). LEFT JOIN gives 4 rows, with users 2 and 3 showing NULL. FULL OUTER JOIN gives 5.
Good to know
- A NULL never equals another NULL, so empty values do not match each other.
- One left row with two matching right rows appears twice.
- A forgotten join condition turns a join into a cross join with n x m rows.
Common questions
- What is the difference between WHERE and ON?
- For INNER JOIN nothing. For a LEFT JOIN, a filter on the right table in WHERE turns it back into an inner join.
- Does MySQL have FULL OUTER JOIN?
- Not directly. People use a LEFT JOIN UNION a RIGHT JOIN.
- How many rows does a join return?
- It can be more or fewer than either table, depending on how many matches each row has.
More in CS Labs & Coding.
Watch 10 sorting algorithms animate step by step with live counters and pseudocode, or race them on the same input.
CS Labs & CodingTOP PICKGraph Algorithm VisualizerTOP PICKDraw your own graph and watch BFS, DFS, Dijkstra, Bellman-Ford, Prim, Kruskal, topological sort and more run step by step, with the queue, the distance table and the reason for every move.
Big-O Estimator from TimingsTime your code on a few input sizes, paste the numbers, and see which growth rate fits best.
OPEN →