What is a SQL JOIN?
Posted: (EET/GMT+2)
Relational databases typically store related information in separate tables. SQL JOIN statements allow those tables to be combined in a query.
Consider two tables, "Customers" and "Orders".
An INNER JOIN returns rows that exist in both tables:
SELECT * FROM Customers INNER JOIN Orders ON Customers.CustomerId = Orders.CustomerId
The JOIN condition tells the database how the rows are related.
Other JOIN types, such as LEFT JOIN, can also return rows that do not have matching entries in the related table.
Using JOINs reduces duplicate data while allowing applications to retrieve related information with a single query.