Oracle 5.0 Reference Manual page 1110

Table of Contents

Advertisement

index_list:
index_name
[, index_name] ...
A table reference is also known as a join expression.
The syntax of
table_factor
only table_reference, not a list of them inside a pair of parentheses.
This is a conservative extension if we consider each comma in a list of
equivalent to an inner join. For example:
SELECT * FROM t1 LEFT JOIN (t2, t3, t4)
ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)
is equivalent to:
SELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)
ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)
In MySQL, JOIN,
CROSS
other). In standard SQL, they are not equivalent.
is used otherwise.
JOIN
In versions of MySQL prior to 5.0.1, parentheses in
join operations were grouped to the left. In general, parentheses can be ignored in join expressions
containing only inner join operations. As of 5.0.1, nested joins are permitted (see
"Nested Join
Optimization").
Further changes in join processing were made in 5.0.12 to make MySQL more compliant with standard
SQL. These charges are described later in this section.
Index hints can be specified to affect how the MySQL optimizer makes use of indexes. For more
information, see
Section 13.2.8.3, "Index Hint
The following list describes general factors to take into account when writing joins.
• A table reference can be aliased using
SELECT t1.name, t2.salary
FROM employee AS t1 INNER JOIN info AS t2 ON t1.name = t2.name;
SELECT t1.name, t2.salary
FROM employee t1 INNER JOIN info t2 ON t1.name = t2.name;
• A
table_subquery
include an alias to give the subquery result a table name. A trivial example follows; see also
Section 13.2.9.8, "Subqueries in the
SELECT * FROM (SELECT 1, 2, 3) AS t1;
and
INNER JOIN
,
produce a Cartesian product between the specified tables (that is, each and every row in the first
table is joined to each and every row in the second table).
However, the precedence of the comma operator is less than of
JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an
error of the form
Unknown column 'col_name' in 'on clause'
dealing with this problem is given later in this section.
• The
conditional_expr
in a
clause. Generally, you should use the
WHERE
tables, and the
WHERE
SELECT
is extended in comparison with the SQL Standard. The latter accepts
JOIN, and
INNER JOIN
tbl_name AS alias_name
is also known as a subquery in the
Clause".
FROM
(comma) are semantically equivalent in the absence of a join condition: both
used with
is any conditional expression of the form that can be used
ON
clause to restrict which rows you want in the result set.
1090
Syntax
are syntactic equivalents (they can replace each
is used with an
INNER JOIN
table_references
Syntax".
clause. Such subqueries must
FROM
INNER
clause for conditions that specify how to join
ON
items as
table_reference
clause,
ON
CROSS
were just omitted and all
Section 8.3.1.9,
or
tbl_name
alias_name:
JOIN,
CROSS
JOIN,
may occur. Information about
LEFT

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents