← All tools

SQL JOIN Visualizer

Compare matching, duplicate and unmatched rows across seven JOIN examples using two synthetic tables.

sql-join-visualizerLOCAL WORKSPACE

Enabling local controls…

Input A · members
idcodename
110Mira
220Noah
320Ren
430Inez
5NULLSol
Input B · visits
idmember_codeactivity
10110Design
10220SQL
10320Data
10440Systems
105NULLTesting

Join on members.code = visits.member_code. Each equal non-NULL key creates one row per pair.

5 rows · 5 matched · 0 left only · 0 right only

On narrow screens, scroll the result table horizontally.

JOIN result rows
member_idmember_codemember_namevisit_idvisit_codevisit_activity
110Mira10110Design
220Noah10220SQL
220Noah10320Data
320Ren10220SQL
320Ren10320Data

Preview: first 32,000 characters. Copy, download and expanded text retain all content. Select complete text if copying fails.

SELECT m.id AS member_id, m.code AS member_code, m.name AS member_name,
       v.id AS visit_id, v.member_code AS visit_code, v.activity AS visit_activity
FROM members AS m
INNER JOIN visits AS v ON m.code = v.member_code
ORDER BY CASE WHEN m.id IS NULL THEN 1 ELSE 0 END, m.id, v.id;
Expand complete selectable text
SELECT m.id AS member_id, m.code AS member_code, m.name AS member_name,
       v.id AS visit_id, v.member_code AS visit_code, v.activity AS visit_activity
FROM members AS m
INNER JOIN visits AS v ON m.code = v.member_code
ORDER BY CASE WHEN m.id IS NULL THEN 1 ELSE 0 END, m.id, v.id;

How to use this tool

Select a join to compare the source tables and output rows. For key 20, two rows from each side produce four pairs. Equality leaves NULL keys unmatched, even when both sides contain NULL.

When not to use it

The three unmatched-only examples filter outer joins with IS NULL on a non-nullable row ID. SQLite supports RIGHT JOIN and FULL OUTER JOIN from 3.39.0. MySQL supports RIGHT JOIN and requires rewriting the two FULL OUTER JOIN examples. The page simulates the output in your browser.