-
Notifications
You must be signed in to change notification settings - Fork 435
FROM clause
Here's a simplified syntax of FROM clause from SQL standard:
FROM table_reference ["," ...]
table_reference:
table_factor | joined_table
joined_table:
table_reference CROSS JOIN table_reference
| table_reference [join_type] JOIN table_reference [join_specification]
| table_reference NATURAL [join_type] JOIN table_reference
join_type:
INNER
| {LEFT | RIGHT | FULL} [OUTER]
join_specification:
ON expr
| USING "(" identifier ["," ...] ")"
Dialects mainly differ in what sort of joins they support:
Does not support NATURAL JOIN.
DB2:
Does not support NATURAL JOIN.
DB2i:
Does not support NATURAL JOIN.
Additionally supports [LEFT|RIGHT] EXCEPTION JOIN
Additionally supports ASOF JOIN (which supports the same syntax as NATURAL ... JOIN).
Additionally supports POSITIONAL JOIN.
Hive:
Does not support NATURAL JOIN and USING specification.
Additionally supports LEFT SEMI JOIN.
Does not support FULL keyword in joins (like FULL OUTER JOIN or NATURAL FULL JOIN).
Does not support NATURAL INNER JOIN.
Additionally supports STRAIGHT_JOIN.
Does not support FULL keyword in joins (like FULL OUTER JOIN or NATURAL FULL JOIN).
Additionally supports STRAIGHT_JOIN.
N1QL:
Does not support FULL keyword in joins.
Does not support NATURAL JOIN and CROSS JOIN.
Does not support USING specification, instead supports:
join_specification:
ON expr
| ON [PRIMARY] KEY expr [FOR identifier]
Support the full standard plus apply-joins:
CROSS APPLYOUTER APPLY
Supports the full standard.
Supports the full standard.
Does not support NATURAL INNER JOIN and NATURAL FULL [OUTER] JOIN
Additionally supports STRAIGHT_JOIN.
Does not support NATURAL INNER JOIN.
Supports the full standard plus:
[LEFT] SEMI JOIN[LEFT] ANTI JOIN
And NATURAL ... JOIN versions of these.
Supports the full standard.
TiDB:
Does not support FULL keyword in joins (like FULL OUTER JOIN or NATURAL FULL JOIN).
Additionally supports STRAIGHT_JOIN.
Does not support NATURAL JOIN and USING specification.
Additionally supports apply-joins:
CROSS APPLYOUTER APPLY
Supports the full standard.