Computers don't think the way humans think. For that reason, when we give our computer directions (such as data mining rules), we have to learn how to speak a version of "English" our computer will understand.
Let's say we want a list of all donors living in New York and Chicago. We would probably write the following:
Select individuals where city = "New York" and city = "Chicago"
With this direction, the computer will take each record, one at a time, and perform the test. With an "and," both conditions must be true for the individual record to be selected. Since an individual's address cannot have both New York and Chicago in the same record, we will get no data output from our request. Although, in English, we typically say "New York and Chicago," in "computer-speak", we should say "New York or Chicago." With an "or," either or both have to be true for the individual to be selected. So, we should have written "or" instead of "and."
We also need to be careful when mixing "and" and "or." For example, if we were to write the following:
Select individuals where city = "New York" or city = "Chicago"
and gift > $1000
In "computer-speak," the "and" is always paired before the "or." In other words, the computer understands the statement above as:
Select individuals where city = "New York"
or (city = "Chicago" and gift > $1000)
This will result in a report where everyone from New York, plus only those individuals in Chicago that gave over $1000 will be included. All of this can be hard to remember, so it's always a great idea to put the brackets in for clarification. The above statement would be better written as follows:
Select individuals where (city = "New York" or city = "Chicago")
and gift > $1000
This will select all individuals in New York and Chicago, that have also given over $1000.
This process is related to simple math formulas like: 5 + 2 X 3. Without following the mathematical rule of BEDMAS (that we all fondly remember learning in grade 6 math class), we would wrongly say that the answer is 21, when in fact, the answer is 11. That's because the multiplication has to be performed first. The order of operation is Brackets first, then Exponents/Roots, then Division/Multiplication, then Addition/Subtraction, followed by Comparisons, and finally logical operators And/Or.