Skip to content
ErgaLab
SQL

SQL JOIN Builder

Name your two tables, pick a join type, and choose the columns that connect them — the correct JOIN syntax is generated as you go.

Tables

Left table (FROM)

Right table (joined)

Join type

Only rows that match in both tables.

Generated query

SELECT *
FROM orders o
INNER JOIN customers c
ON o.customer_id = c.id

How it works

A JOIN combines rows from two tables based on a related column. The join type controls which rows survive when there's no match: INNER JOIN keeps only matching rows, LEFT JOIN keeps every row from the first table regardless of a match, and FULL OUTER JOIN keeps every row from both. CROSS JOIN doesn't use a condition at all — it pairs every row with every row.

Table aliases are optional but recommended once you have more than one table in a query — they keep column references unambiguous and the generated SQL shorter.

Examples

Orders with customer info (INNER JOIN)

Only orders that have a matching customer.

SELECT *
FROM orders o
INNER JOIN customers c
ON o.customer_id = c.id

All customers, with or without orders (LEFT JOIN)

Every customer row is kept.

SELECT *
FROM customers c
LEFT JOIN orders o
ON c.id = o.customer_id

Frequently asked questions