Complex Boolean expressions
In a complex WHERE clause, Boolean operators combine multiple conditions.
The following example combines a function with a complex
qualification:
WHERE year > 95 AND (quarter = 1 OR quarter = 3)
The OR operator combines two functions, equal(quarter,1) and equal(quarter,3). If either is true, the combination is true. The AND operator combines the result of the greaterthan(year,95) with the result of the Boolean OR operator.
If a WHERE clause contains multiple conditions, the database server constructs a qualification descriptor that contains multiple, nested qualification descriptors.
The
following figure shows a complex WHERE clause that contains multiple
levels of qualifications. At each level, a Boolean operator combines
results from two previous qualifications.
Figure 1. Complex WHERE clause
WHERE region = "southwest" AND
(balance < 90 OR aged <= 30)
The qualification descriptors for the preceding expression
have a hierarchical relationship, as the following figure shows.
Figure 3. Qualification- descriptor
hierarchy for a three-key index