Gigsouk

SQL Joins Visualizer

Pick a join type and see exactly which rows come back from the same two small tables — the clearest way to understand joins before an interview.

employees

idnamedept_id
1Ada10
2Grace20
3Alan10
4KatherineNULL
5Edsger40

departments

iddept_name
10Analytics
20Engineering
30Marketing
employeesdepts
SELECT e.name, d.dept_name
FROM employees e
LEFT JOIN departments d ON e.dept_id = d.id;

Every employee, plus their department if there's a match — NULL when there isn't. The most common join in analytics: keep everything in your main table.

Result — 5 rows

namedept_name
AdaAnalytics
GraceEngineering
AlanAnalytics
KatherineNULL
EdsgerNULL

How to use the SQL Joins Visualizer

  1. 1Look at the two example tables.
  2. 2Pick a join type: INNER, LEFT, RIGHT, FULL OUTER or CROSS.
  3. 3Compare the result rows, the diagram and the explanation.

Frequently asked questions

What's the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows with a match in both tables. LEFT JOIN returns every row from the left table, with NULLs where the right table has no match.

Why does my LEFT JOIN act like an INNER JOIN?

A WHERE condition on a column from the right table removes the NULL rows. Move that condition into the ON clause.

Why did my join return more rows than expected?

If the join key isn't unique on one side, each match multiplies rows. Check for duplicate keys, or aggregate before joining.

More free tools

All tools →

Put your skills to work

Thousands of open roles from companies hiring now — apply directly with the employer.