Last updated: August 27, 2026.
A join combines related rows from two tables. Prefer explicit JOIN ... ON syntax because it keeps the relationship separate from ordinary filters.
Syntax
SELECT a.column_name, b.column_name
FROM table_a AS a
INNER JOIN table_b AS b ON b.foreign_key = a.primary_key;Example
SELECT a.EmployeeIDNo, a.FirstName, a.LastName, s.Salary
FROM EmployeeAddressTable AS a
INNER JOIN EmployeeStatisticsTable AS s
ON s.EmployeeIDNo = a.EmployeeIDNo;INNER JOIN returns matching rows. LEFT JOIN also keeps unmatched rows from the left table and fills right-side columns with Null.
See the current PostgreSQL SQL reference; confirm dialect details for your own database.