JOINED TABLE (
joined table) can be specified as part of a FROM TABLE specification (from table spec).Syntax
<joined_table> ::=
<from_table_spec> CROSS JOIN <from_table_spec>
| <from_table_spec> [INNER] JOIN <from_table_spec> <join_spec>
| <from_table_spec> [<LEFT | RIGHT | FULL> [OUTER]] JOIN <from_table_spec> <join_spec>
<join_spec> ::= ON <search_condition> | USING (<column_name>,...)
from_table_spec, search_condition, column_nameExplanation
If a FROM TABLE specification comprises a JOINED TABLE, the result is generated as follows:
Let FT1 be the set of all rows in the table specified by the first from table specification. Let FT2 be the set of all rows in the table specified by the second from table specification.
Let T be the set of result rows consisting of all possible combinations of FT1 and FT2. Each result row satisfies the join specification for this set.
The rules specified for the
WHERE condition apply to the JOIN specification (join_spec) ON <search_condition>.If the JOIN specification (
join_spec) USING (<column_name>,...) is specified, the column names must denote columns that are contained in both FT1 and FT2 and for which the user has the SELECT privilege. Specifying the JOIN specification USING (<column_name>,...) means the same as comparison predicates between the specified columns in FT1 and FT2 linked with AND. = is used as a comparison operator (comp_op).