SELECT FROM TWO TABLES: SYNTAX
(Recommended,
ANSI-style)
SELECT column list
FROM table1
INNER JOIN table2
ON
table1.col1=table2.col2
WHERE criteria
ORDER BY column list
(Older,
theta-style)
SELECT column list
FROM table1, table2
WHERE
table1.col1=table2.col2
AND other criteria
ORDER BY column list
Note:
-
col1 in table1 is usually that table's
primary key
-
col2 in table2 is a foreign key in that table
-
col1 and col2 must have the same data type
and for certain
data types, the same size