INNER JOIN

See how INNER JOIN returns only the intersection of two tables with live connector lines and a Venn diagram. Edit keys and watch the result change.

Join type

Data (click a cell to edit)

SELECT * FROM A
INNER JOIN B
  ON A.key = B.key

ON A.key = B.key — empty keys are treated as SQL NULL and never match

Table A

keyval

Table B

keyval
Matched rowsRows only in ARows only in B

Result

Result rows: 2Matched: 2A only: 0B only: 0
A.keyA.valB.keyB.val
1kim1dev
3park3hr

Edit a key or add a row — the connector lines and result update instantly. The 'Duplicate key' preset shows why LEFT JOIN row counts can grow.

INNER JOIN returns only rows where the ON condition holds in both tables. Rows existing on just one side disappear entirely, so the result can be smaller than the driving table.

Watch for the opposite too — with duplicate join keys one row matches multiple partners and the result grows (1:N fan-out). The 'Duplicate key' preset shows A.key=2 fanning out to two rows of B.

Most production JOIN bugs come from silently losing rows with INNER JOIN. During migrations, aggregate with LEFT JOIN first to see the difference before narrowing to INNER. SQL JOIN Visualizer

Frequently asked questions

Is INNER JOIN the same as AND conditions in WHERE?
For INNER JOIN the result is identical. But for LEFT/RIGHT JOIN it changes semantics, so prefer writing join conditions in ON.
Why is my INNER JOIN returning more rows than expected?
Duplicate join keys. If key 2 appears twice in A and three times in B, you get 2×3=6 rows. Check the 'Duplicate key' preset to see fan-out live.
Do NULL keys join to each other?
No. NULL is not comparable — NULL = NULL is not true. In the 'NULL key' preset, empty-key rows stay unmatched with no connector line.

Other joins