See RIGHT JOIN preserve every row of B while filling unmatched A columns with NULL — and why it's just LEFT JOIN with the tables swapped.
Join type
Data (click a cell to edit)
SELECT * FROM A RIGHT JOIN B ON A.key = B.key
ON A.key = B.key — empty keys are treated as SQL NULL and never match
Table A
Table B
Result
| A.key | A.val | B.key | B.val |
|---|---|---|---|
| 1 | kim | 1 | dev |
| 3 | park | 3 | hr |
| NULL | NULL | 4 | fin |
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.
RIGHT JOIN preserves every row of the right table (B) and fills unmatched A columns with NULL — the mirror image of LEFT JOIN.
A RIGHT JOIN B is exactly B LEFT JOIN A. Most teams standardize on LEFT JOIN for readability, and some ORMs cannot even generate RIGHT JOIN.
RIGHT JOIN earns its place when the driving table happens to be on the right — reordering a chain of joins around it can simplify the query. SQL JOIN Visualizer