Combine rows from two or more tables based on a related column. All core join types are universally supported. Search for a specific type: <a href="#" onclick="searchCommand('inner join'); return false;">INNER JOIN</a>, <a href="#" onclick="searchCommand('left join'); return false;">LEFT JOIN</a>, <a href="#" onclick="searchCommand('right join'); return false;">RIGHT JOIN</a>, <a href="#" onclick="searchCommand('full outer join'); return false;">FULL OUTER JOIN</a>, <a href="#" onclick="searchCommand('cross join'); return false;">CROSS JOIN</a>.

Combines rows from two or more tables based on a related column. INNER JOIN drops rows with no match; OUTER JOIN (LEFT/RIGHT/FULL) preserves them. Missing join conditions create Cartesian products -- always double-check your ON clauses.

Compatibility

Show:
Database System Support Status Since Version Notes
MySQL ✓ Supported all All standard join types supported.
PostgreSQL ✓ Supported all All standard join types supported.
SQL Server ✓ Supported all All standard join types supported.
Oracle ✓ Supported all All standard join types supported. Legacy (+) outer-join syntax also exists.
SQLite ✓ Supported all All join types supported; RIGHT JOIN and FULL OUTER JOIN added in 3.39.0.

Details

SQL JOINs are the primary mechanism for combining rows across tables. See specific types: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN.

Standard Syntax

SELECT a.col, b.col FROM table_a a JOIN table_b b ON a.id = b.a_id;

Version Support

MySQL: Since all PostgreSQL: Since all SQL Server: Since all Oracle: Since all SQLite: Since all

Per-Database Syntax & Notes

MySQL

All standard join types supported.

SELECT a.col, b.col FROM a JOIN b ON a.id = b.a_id;

PostgreSQL

All standard join types supported.

SELECT a.col, b.col FROM a JOIN b ON a.id = b.a_id;

SQL Server

All standard join types supported.

SELECT a.col, b.col FROM a JOIN b ON a.id = b.a_id;

Oracle

All standard join types supported. Legacy (+) outer-join syntax also exists.

SELECT a.col, b.col FROM a JOIN b ON a.id = b.a_id;

SQLite

All join types supported; RIGHT JOIN and FULL OUTER JOIN added in 3.39.0.

SELECT a.col, b.col FROM a JOIN b ON a.id = b.a_id;