FROM Clause: ANSI Syntax

Joins two datasources in a query using outer or inner join syntax.

Syntax

FROM { source [ [(DYNAMIC|STATIC)] [AS] alias] [keep_clause] | nested_join }
[INNER|RIGHT|LEFT|FULL] JOIN
{ source [ [(DYNAMIC|STATIC)] [AS] alias] [keep_clause] | nested_join }
on_clause

Components

source The name of a data stream, window, reference, or delta stream.
DYNAMIC | STATIC DYNAMIC indicates the data in the window or stream being joined is going to change often. A secondary index is created on windows joining with an incomplete primary key of a DYNAMIC window or stream. This improves performance but uses additional memory proportional to the total data length of key columns in the index. By default, windows and streams are STATIC and no secondary indices are created.
alias An alternate name for the source.
keep_clause An optional policy that specifies how rows are maintained in the window (it cannot be used with a reference, stream, or delta stream).
nested_join A nested join — see below.

Usage

For outer joins, use an ON clause to specify the join condition. This is optional for inner joins.

You can use this variation of FROM to create inner, left , right, and full joins:
JOIN If no join type is specified, the default is INNER.
INNER JOIN All possible combinations of rows from the intersection of both datasources (limited by the selection condition, if one is specified) are published.
RIGHT JOIN All possible combinations of rows from the intersection of both datasources (limited by the selection condition, if one is specified) are published. All the other rows from the right datasource are also published. Unmatched columns in the left datasource publish a value of NULL .
LEFT JOIN All possible combinations of rows from the intersection of both datasources (limited by the selection condition, if one is specified) are published. All the other rows from the left datasource are also published. Unmatched columns in the right datasource publish a value of NULL.
FULL JOIN All possible combinations of rows from the intersection of both datasources (limited by the selection condition, if one is specified) are published. All other rows from both datasources are published as well. Unmatched columns in either datasource publish a value of NULL .

The datasources used with this syntax can include data stream expressions, named and unnamed window expressions, queries, and references. You can use aliases for the datasources in this variation of the FROM clause.

The join variation of the FROM clause (ANSI syntax) is limited to two datasources. Accommodate additional datasources using a nested join as one of the datasources. If a nested join is used, it can optionally be enclosed in parentheses, and can include its own ON clause. The rules for the use of the ON clause with a nested join are the same as the rules that govern the use of the ON clause in the join containing the nested join.

Restrictions