Anda di halaman 1dari 1

Chapter 3: Selecting 81

<join_operator> ::= <inner_join>


| <left_outer_join>
| <right_outer_join>
| <full_outer_join>
<inner_join> ::= INNER JOIN
| JOIN
<left_outer_join> ::= LEFT OUTER JOIN
| LEFT JOIN
<right_outer_join> ::= RIGHT OUTER JOIN
| RIGHT JOIN
<full_outer_join> ::= FULL OUTER JOIN
| FULL JOIN
<on_condition> ::= ON <boolean_expression> -- highly recommended
<table_reference> ::= [ <owner_name> "." ] <table_name>
[ [ AS ] <correlation_name> ]
[ <hints> ]
<view_reference> ::= [ <owner_name> "." ] <view_name>
[ [ AS ] <correlation_name> ]
[ <hints> ]
<owner_name> ::= <identifier>
<table_name> ::= <identifier>
<correlation_name> ::= <identifier>
<view_name> ::= <identifier>
<identifier> ::= see <identifier> in Chapter 1, "Creating"
This book concentrates on FROM clauses that use modern join operators like
INNER JOIN and LEFT OUTER JOIN, and it avoids discussions of
comma-separated lists of table expressions. The comma in a list of table expres-
sions is actually a kind of comma join operator, often equivalent to CROSS
JOIN, but not always; sometimes it works like an INNER JOIN, and when it is
combined with other join operators it can become very confusing. One excep-
tion comes in Section 3.8, LATERAL Procedure Call, where the comma is
required to take advantage of a useful feature: a join involving a stored proce-
dure call that receives a column from another table as an argument. Throughout
the rest of this book, however, there arent many commas in the FROM clause.

Tip: Dont use defaults or the shorthand notation when specifying join opera-
tors. In particular, dont just code the JOIN operator without one of the qualifiers
INNER or OUTER, dont use the shorthand keywords KEY and NATURAL, and
dont forget to code an ON condition for every join except CROSS JOIN. Be
clear and explicit with the join operators and the result will be easier to under-
stand and debug. The defaults and shorthand notation dont save much coding,
and the results can be confusing, especially with multi-table joins.

Table and view references in the FROM clause may contain hints that influence
how SQL Anywhere handles this particular table or view, for this particular
query:
<hints> ::= HOLDLOCK -- ISOLATION_LEVEL = 3
| WITH "(" [ <hint_list> ] ")"
<hint_list> ::= <hint> { <hint> }
<hint> ::= FASTFIRSTROW -- OPTIMIZATION_GOAL = 'first-row'
| NOLOCK -- ISOLATION_LEVEL = 0
| READUNCOMMITTED -- ISOLATION_LEVEL = 0
| READCOMMITTED -- ISOLATION_LEVEL = 1
| REPEATABLEREAD -- ISOLATION_LEVEL = 2
| HOLDLOCK -- ISOLATION_LEVEL = 3
| SERIALIZABLE -- ISOLATION_LEVEL = 3

Anda mungkin juga menyukai