images/contents.gifimages/index.gif

Relative order of Query Elements

As seen already, every query operator requires two query elements to serve as operands for whatever operation is performed by the operator. The query element to the left of the operator is known as the first operand, and the element to the right of the operator is the second operand. Some types of operations will produce the same results, regardless of which query element is the first operand and which is the second; such operations are said to be commutative. When switching the order of the operands can produce different results, the operation is said to be non-commutative. Because we have not yet defined the actual query operators available when searching news headlines, we will use two familiar operations from arithmetic to illustrate this principle:

5 + 2 = 7, and 2 + 5 = 7
The answer is the same for both orderings; addition is commutative.

5 - 2 = 3, but 2 - 5 = -3

Subtraction is clearly not commutative. Order makes a difference.

Likewise, certain query operators are commutative, and some are not. The description of each operator will clarify this point as needed.