The JOIN Clause
Learn how to efficiently retrieve data from related tables using the SQL JOIN keyword.
We'll cover the following...
Introduction
SQL offers two distinct methods for joining tables. One method utilizes the standard WHERE
clause, as demonstrated earlier. The other method employs the JOIN
keyword for this purpose. The approach without the JOIN
keyword may seem simpler initially but becomes intricate as queries grow in complexity. Conversely, the JOIN
keyword method is more structured and easier to comprehend, particularly in complicated scenarios.
Structure of the SQL JOIN
statement
The following is a typical structure of an SQL statement that uses JOIN
:
SELECT columnsFROM table1INNER JOIN table2ON table1.column = table2.column;
Structure of SQL JOIN
As can be seen, the JOIN
clause has two components:
The first one refers to the table to be joined with the one mentioned ...