Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual page 183

Table of Contents

Advertisement

Example 1: Key join
Example 2: ON clause
join
Example 3: Natural
join
search-condition :
[ ( ] search-expression [ AND search-expression ] [ ) ]
The join-clause can be expressed either with or without parentheses.
The
clause can reference only two tables. One must be the current one,
ON
and the other can be any one table in the current join tree.
All join predicates must be equijoins; that is, the search_expression must
indicate that the value in column_1 equals the value in column_2. No
single-variable predicates, intracolumn comparisons, or non-equality joins
are permitted in the
To specify a multicolumn join, you include more than one predicate
linking the two tables, and connect them with logical AND.
You cannot connect join predicates with logical OR.
The keyword
NATURAL
columns from a single pair of tables by name.
Here is an example of how you create a join index for the key join between the
table and the
sales_order
based on the foreign key
to the primary key
sales_order
any name you want. This example names it
foreign key on which the key join relies.
CREATE JOIN INDEX ky_so_customer_join
FOR customer FULL OUTER JOIN sales_order
The next example shows how you could create a join index for the same two
tables using an
clause. You could use this syntax whether or not the foreign
ON
key existed.
CREATE JOIN INDEX customer_sales_order_join
FOR customer FULL OUTER JOIN sales_order
ON customer_id=sales_order.cust_id
To create a natural join, the joined columns must have the same name. If you
created a natural join on the tables in previous examples, you would not get the
expected results at all. Instead of joining the
column of
cust_id
sales_order
dissimilar
columns of the two tables:
id
CREATE JOIN INDEX customer_sales_order_join
FOR customer NATURAL FULL OUTER JOIN sales_order
CHAPTER 4
Adaptive Server IQ Indexes
clause.
ON
can replace the
clause, when you are pairing
ON
table. Remember that this is a key join,
customer
which relates the
ky_so_customer
of the
table. You can give the index
id
customer
ky_so_customer_join
column of
id
, the following command would join the
column of
cust_id
to identify the
to the
customer
163

Advertisement

Table of Contents
loading

Table of Contents