SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-103
Considerations for Search Condition
Considerations for Search Condition
Order of Evaluation
SQL evaluates search conditions in this order:
1. Predicates within parentheses
2. NOT
3. AND
4. OR
Column References
Within a search condition, a reference to a column refers to the value of that column in
the row currently being evaluated by the search condition.
Subqueries
If a search condition includes a subquery and the subquery returns no values, the
predicate evaluates to null. See Subquery on page 6-105.
Examples of Search Condition
Select rows by using a search condition composed of three comparison predicates
joined by AND operators:
select O.ordernum, O.deliv_date, OD.qty_ordered
FROM sales.orders O,
sales.odetail OD
WHERE qty_ordered < 9 AND deliv_date <= DATE '1998-11-01'
AND O.ordernum = OD.ordernum;
ORDERNUM DELIV_DATE QTY_ORDERED
---------- ---------- -----------
100210 1997-04-10 3
100210 1997-04-10 3
100210 1997-04-10 6
100250 1997-06-15 4
101220 1997-12-15 3
...
--- 28 row(s) selected.