SQL JOIN Builder

Build SQL JOIN queries visually — select tables, join types, conditions, and columns without writing SQL from scratch.

Base Table

JOIN Table

JOIN Type Reference

INNER JOIN — rows matching both tables
LEFT JOIN — all left + matching right (NULL if no match)
RIGHT JOIN — all right + matching left
FULL OUTER JOIN — all rows from both tables
CROSS JOIN — cartesian product (all combinations)

About SQL JOINs

SQL JOINs combine rows from two or more tables based on a related column. They are fundamental to relational database design — instead of storing all data in one flat table, data is normalized into related tables and JOINs are used to query across them. Understanding the different JOIN types is essential for any developer working with relational databases.

INNER JOIN returns only rows where there is a match in both tables — it's the most common join type. LEFT JOIN returns all rows from the left (base) table plus any matching rows from the right table; non-matching right-side rows are NULL. This is useful for "get all orders, and the user info if available." RIGHT JOIN is the mirror image. FULL OUTER JOIN combines both, returning all rows from both tables with NULLs where there's no match.

FAQ

When should I use LEFT JOIN vs INNER JOIN?
Use INNER JOIN when you only want rows with matches in both tables (e.g., orders WITH a valid user). Use LEFT JOIN when you want all rows from the base table even if there's no match (e.g., all users, with their order count — users with no orders get 0 via COALESCE).
Why use table aliases?
Table aliases (o for orders, u for users) make queries shorter and more readable, especially with multiple JOINs. They also resolve ambiguous column names when two joined tables have columns with the same name (o.created_at vs u.created_at).