Database Reference
In-Depth Information
82
Customers with
cre dit limits that are
greater than their
balances
FIGURE 3-14
Query results
COMPOUND CONDITIONS
The conditions you
ve seen so far are called simple conditions. The following examples require compound
conditions. A compound condition is formed by connecting two or more simple conditions using one or both
of the following operators: AND and OR. You can also precede a single condition with the NOT operator to
negate a condition.
When you connect simple conditions using the AND operator, all the simple conditions must be true for
the compound condition to be true. When you connect simple conditions using the OR operator, the com-
pound condition will be true whenever any of the simple conditions are true. Preceding a condition by the
NOT operator reverses the truth or falsity of the original condition. That is, if the original condition is true,
the new condition will be false; if the original condition is false, the new one will be true.
'
EXAMPLE 8
List the descriptions of all parts that are located in warehouse 3 and for which there are more than 20 units
on hand.
In this example, you want to list those parts for which both the warehouse number is equal to 3 and the
number of units on hand is greater than 20. Thus, you form a compound condition using the AND operator,
as shown in Figure 3-15.
C ompound
condition
Because the condition
contains the AND operator,
both conditions must be true
for a record to appear in the
query results
FIGURE 3-15
Compound condition that uses the AND operator
Search WWH ::




Custom Search