text only
WOU Logo
JavaScript is Disabled in your Browser; Not all features are available.
See for yourself whether WOU is right for you. Freshman, Transfer, Graduate and International Student Information Locate any type of information on our site.


 Library & Media Services
 
Boolean Operations
 

It is essential to understand Boolean logic to search databases and the Internet effectively. Boolean language deals with sets and with which items meet named criteria. It can be deceptively hard because of the simplicity of the words used: AND and OR. The explanations below reveal how the Boolean use of these words differs from the natural language use of them.

The OR Operator
  1. Using OR between words says to the database that you will accept any item that meets either criterion.
  2. OR is useful for separating words that represent the same general idea or concept.
  3. The resulting set will be larger (broader) than the set from a single word search.
  4. How it differs from natural language: The word "or" often means that one choice of several--narrows the field rather than broadening it as in Boolean language.
Visual example:    
For each search phrase, how many items meet the criteria (fit into the set)?
Q1. Yellow OR green
Q2. fish OR bird
Q3. lion OR tiger
 
a.
b.
c.
d.
e.
f.
Answers: # in set  
Q1. 4 (specifically, a, c, e, & f)
Q2. 2 (specifically, c & e)
Q3. 1 (specifically, only b)

Verbal example:

Please buy me a Hershey OR a Twix OR an Almond Joy candy bar.   Result: If you bring me any one of these three choices, I'll be so happy! You could also buy me two or three of these choices and still meet my criteria.

The AND Operator
  • Using AND between words says to the database that you will accept only those items that meet both criteria simultaneously.
  • AND is useful for combining concepts, for finding where two or more concepts intersect.
  • The resulting set will be smaller (narrower) than the set from a single word search.
  • How it differs from natural language: The word "and" often means an increase in number--it adds to a group rather than requires an additional feature as in Boolean language.

Visual example:    
For each search phrase, how many items meet the criteria (fit into the set)?
Q4. Yellow AND can fly
Q5. black AND has legs
Q6. lion AND tiger
 
a.
b.
c.
d.
e.
f.
Answers: # in set  
Q4. 2 (specifically, a & c)
Q5. 4 (specifically, a, b, c, & d)
Q6. 0

nothing can be a tiger and a lion simultaneously!

Verbal example:

I want a candy bar that has chocolate AND caramel AND peanuts.   Result: To meet my sweet-tooth demands, you can only provide goodies with all three ingredients together. Further, my first stated criterion is that what you bring is a candy bar, not some other concoction like Cracker Jacks with chocolate chips thrown in.
The NOT Operator
  • Using NOT between words says to the database that you want everything that meets the first criterion as long as the second criterion is not present.
  • NOT is useful for excluding items, particularly when the first word has multiple contexts.
  • The resulting set will be smaller than the single word search.
  • How it differs from natural language: It doesn't! This is the easy one.
Visual example:    
For each search phrase, how many items meet the criteria (fit into the set)?
Q7. water-dweller NOT yellow
Q8. black NOT insect
Q9. animal NOT lion
 
a.
b.
c.
d.
e.
f.
Answers: # in set  
Q7. 1 (specifically, e)
Q8. 2 (specifically, b & c)
Q9. 6 since there is not a lion in the full set, NOT eliminates nothing.

Verbal example:

I want a chocolate bar but NOT one with coconut!   Result: I'll be satisfied with anything you choose from the candy bar aisle except for Almond Joy or Mounds (or any others with coconut).
Combining Operators
  • You can use multiple Boolean operators in a single search
  • The operators do not act in order from left to right; instead, the AND operates first, then the OR, and finally the NOT.
  • To override the order of the operations, use parentheses to nest terms together.

Visual example:    
For each search phrase, how many items meet the criteria (fit into the set)?
Q10. insect OR bird AND yellow
Q11. (insect OR bird) AND yellow
Q12. (yellow OR black) NOT (insect OR bird)
 
a.
b.
c.
d.
e.
f.
Answers: # in set  
Q10. 3 (specifically, a, c, & d)
Q11. 2 (specifically, a & c)
Q12. 2 (specifically, b & f)
 

Verbal example:

I want a candy bar that has chocolate AND caramel NOT peanuts OR peanut butter OR almonds OR almond oil.   Result: I know, I know--I'm picky! You'd spend a while finding me just the right treat. Luckily, computers can conduct these complex searches instantaneously in databases with hundreds of thousands of records.
 Western Oregon University Contact Information
Last Updated: Tuesday, 20 April, 2004 12:11 PM