In order to join two tables, we will utilize the basic structure of a SELECT
statement; but, we must add a few qualifiers.
When we join two tables, we add a WHERE
clause that qualifies that the common columns between the tables are equivalent. The following is the syntax tree for an ANSI-compliant join:
SELECT column1, column2, ... FROM table1, table2 WHERE table1.common_column = table2.common_column;
While the join syntax is similar in many ways to a typical select
statement, we notice some differences.
As you might expect, since we are selecting data from two tables, both table names are specified in the
FROM
clause, separated by commasThe syntax of the
WHERE
clause is different from what we've previously seenIn our
WHERE
clause, we specify the condition that the common column from the first table must be equal to the common column in the second
In constructing this part of the statement, it is important...